Creating Your OWN GitHub Action Using Go (golang) [Getting Started]
HTML-код
- Опубликовано: 28 янв 2025
- In this video, I show you not only how to USE GitHub Actions, but how to CREATE your own GitHub Action to use internally or even publish to the marketplace.
We will go over:
1. Writing Go code
2. Writing a GitHub Action YAML
3. Publishing the code
4. Creating versions of the code
5. Using the code in a GitHub Action
Let's jump right in!
Twitter: / thenjdevopsguy
Blog: www.clouddev.e...
#golang #development #100DaysOfCode
very nice example - looking forward to trying this out
Cool -- I have created actions with the JS and Docker versions, but not a composite run steps action. Nice tutorial!
Thank you! Yeah, composites are slightly new. Originally it was just JS and Docker, but devs wanted a way to write Actions in other languages.
@@CloudDevEngineering -- but... Docker already supports ALL the languages! 😎
(the composite syntax does look nicer for things that don't require the full configuration control of Docker)
@@DevOpsDirective You're right, it does. However, Docker Actions can only run on Linux. With composites, you can run them on Linux, MacOS, and Windows agents.
can you make this small tutorial a little bit more complex by turning it into a small REST server and deploy it to a cloud service (free tier AWS EC2 for example) , then make a change in code and push the new code to Github. So newbies can see how Github Action can make our life easier?
I definitely have a few more ideas for content like this! I'll put this on the board.
OK.. so I have another issue.. in my build, it fails with unexpected command "go run main.go shell bash". the next line says Unexpected StringToken encountered, the type MappingToken was expected. I was questioning why there is no - before shell: bash in your action.yml file?
Can you send me your repo if it's public?
@@CloudDevEngineering Sorry sadly it's not. :( I was trying this as I want to get some auto builds going when I commit to our private repo.
@@jackofalltrades8212 Ahh, I see what you mean. Hmm.. is there any snippet/screenshot you can share with me that won't impact any NDAs? Otherwise, it's a bit difficult besides just guessing :(
@@CloudDevEngineering I will see what I can come up with tomorrow.. it could be something in my own repository, not sure. It was such a simple example I figured it should just work. :).
@@jackofalltrades8212 Absolutely! Any information you can share with me, it would help a ton.
Interesting..however, like you I did tag first, pushed, then pushed my code.. and tried to match your step to remove tag, retag, then push tag. Unfortunately, my git push --tags now tells me tag v1 already created on remote. Unclear why I see that and you dont? Anyway, had to do a git push --delete origin v1 first.. to remove remote v1 tag, then git push --tags worked.
Really? Strange. What version of Git are you using?
@@CloudDevEngineering I think it is because you had committed (but not pushed) so the v1 tag was associated with the correct commit already. If you had tagged before committing you would have hit the same issue described by @jack of all trades
thanks!