v0.1.23 #29
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish image | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.extract_tag.outputs.version }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Setup Go environment | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.20' | |
- name: Setup private Go modules | |
run: | | |
echo "machine github.com login ${{ secrets.GH_SECRET }}" > ~/.netrc | |
chmod 600 ~/.netrc | |
- name: Download Go module dependencies | |
run: go mod vendor | |
- name: Extract tag name | |
id: extract_tag | |
run: | | |
TAG_NAME=${GITHUB_REF#refs/tags/} | |
echo "Extracted tag name: $TAG_NAME" | |
echo "::set-output name=version::$TAG_NAME" | |
- name: Print version for debugging | |
run: echo "VERSION is ${{ steps.extract_tag.outputs.version }}" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GH_USERNAME }} | |
password: ${{ secrets.GH_SECRET }} | |
- name: Lowercase repo name | |
id: repo | |
run: echo "repo=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Build and push image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: | | |
ghcr.io/${{ env.repo }}:${{ steps.extract_tag.outputs.version }} | |
ghcr.io/${{ env.repo }}:latest | |
build-args: | | |
VERSION=${{ steps.extract_tag.outputs.version }} | |
ACCESS_TOKEN_USR=${{ secrets.GH_USERNAME }} | |
ACCESS_TOKEN_PWD=${{ secrets.GH_SECRET }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: flyctl deploy -c fly.toml --remote-only --dockerfile Dockerfile --env VERSION=${{ needs.build.outputs.version }} | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |