Skip to content

added GHA for build and deploy devnet (#79) #174

added GHA for build and deploy devnet (#79)

added GHA for build and deploy devnet (#79) #174

Workflow file for this run

name: goreleaser
on:
push:
tags:
- '*'
permissions:
contents: write
packages: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v5
-
name: Generate changelog
uses: addnab/docker-run-action@v3
with:
registry: gcr.io
image: ghcr.io/web-seven/git-chlog:0.15.4
options: -v ${{ github.workspace }}:/workspace
run: |
cd /workspace;
git config --global --add safe.directory /workspace;
git-chglog -o .cache/changelog.md $(git describe --tags $(git rev-list --tags --max-count=1));
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean --release-notes .cache/changelog.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Extract tag name
id: tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
-
name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ env.TAG }}
-
name: 'Gcloud Auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
-
name: Set up gcloud
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
-
name: Deploy updated image to GCP VM
run: |
gcloud compute instances update-container ${{ secrets.GCP_INSTANCE_NAME }} \
--zone=${{ secrets.GCP_ZONE }} \
--container-image=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ env.TAG }}