前書いたのの別バージョン。開発中はタグ名じゃなくて、SHORT_SHAにしたい。
"on": push: branches: - develop jobs: build_and_deploy: runs-on: ubuntu-latest timeout-minutes: 5 steps: - name: Checuout uses: actions/checkout@v2 - name: Get the version id: get_version # gitコマンドを使ってSHORT SHAを取得 run: echo ::set-output name=VERSION::$(git rev-parse --short HEAD) - name: Do something run: ... env: # stepIdの"get_version"を使って、outputs.VERSIONを取得 VERSION: ${{ steps.get_version.outputs.VERSION }}
GITHUB_SHA
であれば、環境変数に設定されているので、そのまま使える。
・環境変数 - GitHub Docs