easwee.net // tiny digital playground

github actions devlog

I've been migrating a lot of Gitlab deployment pipelines to Github lately. Github actions are a nice thing, but take some getting used to, before you can mirror your deployment strategy to the one you had on Gitlab. Writing down some public personal notes for future reference:

job_name:
  environment:
    name: production
    url: https://www.example.com

jobs:
  sanitize_branch:
    name: sanitize branch name job
    runs-on: ubuntu-latest
    outputs:
      output: ${{ steps.sanitize_branch.outputs.sanitized_branch }}
    steps:
      - id: sanitize_branch
        run: |
          REPO="${{ github.head_ref }}"
          REPO_SANITIZED="${REPO////-}"
          echo "::set-output name=sanitized_branch::${REPO_SANITIZED}"
  another_job:
    needs: [sanitize_branch]
    name: just another separate job
    runs-on: ubuntu-latest
    steps:
    	- run: echo ${{needs.sanitize_branch.outputs.output}}

Github is not the same in terms of features compared to Gitlab, but with a few workarounds on Github and Github Actions you get to same or similar results.