Skip to content

v0.1.6

v0.1.6 #16

Workflow file for this run

name: Release - Build and Push Image
on:
release:
types: [created]
permissions:
contents: write
packages: write
pages: write
id-token: write
env:
IMAGE_REPO: ghcr.io/forkspacer/api-server
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Extract release tag
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "CHART_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Update Helm Chart version
run: make update-version VERSION=$VERSION
- name: Build application
run: go build -v ./...
- 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: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ env.IMAGE_REPO }}:${{ env.VERSION }}
${{ env.IMAGE_REPO }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Install Helm
uses: azure/[email protected]
- name: Create charts directory
run: |
make build-charts-site
- name: Upload chart to current release
run: |
CHART_VERSION="${GITHUB_REF#refs/tags/v}"
CHART_FILE="api-server-${CHART_VERSION}.tgz"
echo "📦 Uploading $CHART_FILE to release $VERSION..."
gh release upload $VERSION $CHART_FILE --clobber
echo "✅ Chart uploaded to GitHub Release"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: charts-site
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
- name: Summary
run: |
make helm-summary
- name: Notify forkspacer repository of new version
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.DEPENDENCY_UPDATE_TOKEN }}
repository: forkspacer/forkspacer
event-type: dependency-update
client-payload: |
{
"component": "api-server",
"version": "${{ env.VERSION }}",
"chart_version": "${{ env.CHART_VERSION }}"
}
- name: Trigger version update PR
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.DEPENDENCY_UPDATE_TOKEN }}
event-type: version-update
client-payload: |
{
"version": "${{ env.VERSION }}",
"chart_version": "${{ env.CHART_VERSION }}"
}