Skip to content

Merge pull request #65 from chipmk/chore/ci-release-workflow #1

Merge pull request #65 from chipmk/chore/ci-release-workflow

Merge pull request #65 from chipmk/chore/ci-release-workflow #1

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
packages: write
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./client
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/chipmk/docker-mac-net-connect/setup:${{ github.ref_name }}
ghcr.io/chipmk/docker-mac-net-connect/setup:latest
goreleaser:
runs-on: macos-latest
needs: docker
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update-homebrew:
runs-on: ubuntu-latest
needs: goreleaser
steps:
- name: Update Homebrew formula
env:
TAG: ${{ github.ref_name }}
TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
set -euo pipefail
TARBALL_URL="https://github.com/chipmk/docker-mac-net-connect/archive/refs/tags/${TAG}.tar.gz"
SHA=$(curl -sfL "$TARBALL_URL" | shasum -a 256 | cut -d' ' -f1)
if [ -z "$SHA" ] || [ "$SHA" = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" ]; then
echo "Failed to download tarball or got empty response"
exit 1
fi
git clone "https://x-access-token:${TAP_TOKEN}@github.com/chipmk/homebrew-tap.git" tap
cd tap
sed -i "s/version \".*\"/version \"${TAG}\"/" Formula/docker-mac-net-connect.rb
sed -i "s/sha256 \".*\"/sha256 \"${SHA}\"/" Formula/docker-mac-net-connect.rb
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/docker-mac-net-connect.rb
git commit -m "Update docker-mac-net-connect to ${TAG}"
git push