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

Комментарии • 17

  • @reedwade1291
    @reedwade1291 4 года назад +1

    very nice example - looking forward to trying this out

  • @DevOpsDirective
    @DevOpsDirective 4 года назад

    Cool -- I have created actions with the JS and Docker versions, but not a composite run steps action. Nice tutorial!

    • @CloudDevEngineering
      @CloudDevEngineering  4 года назад

      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.

    • @DevOpsDirective
      @DevOpsDirective 4 года назад

      @@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)

    • @CloudDevEngineering
      @CloudDevEngineering  4 года назад +1

      @@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.

  • @HoangVo7
    @HoangVo7 4 года назад +2

    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?

    • @CloudDevEngineering
      @CloudDevEngineering  4 года назад

      I definitely have a few more ideas for content like this! I'll put this on the board.

  • @jackofalltrades8212
    @jackofalltrades8212 4 года назад

    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?

    • @CloudDevEngineering
      @CloudDevEngineering  4 года назад

      Can you send me your repo if it's public?

    • @jackofalltrades8212
      @jackofalltrades8212 4 года назад

      @@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.

    • @CloudDevEngineering
      @CloudDevEngineering  4 года назад

      @@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 :(

    • @jackofalltrades8212
      @jackofalltrades8212 4 года назад

      @@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. :).

    • @CloudDevEngineering
      @CloudDevEngineering  4 года назад

      @@jackofalltrades8212 Absolutely! Any information you can share with me, it would help a ton.

  • @jackofalltrades8212
    @jackofalltrades8212 4 года назад

    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.

    • @CloudDevEngineering
      @CloudDevEngineering  4 года назад

      Really? Strange. What version of Git are you using?

    • @DevOpsDirective
      @DevOpsDirective 4 года назад +1

      @@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

  • @hamzamasood703
    @hamzamasood703 Год назад

    thanks!