Alpha Release #7
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: Alpha Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Alpha version tag (1, 2, 3...)" | |
required: true | |
jobs: | |
create-tag: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get_version.outputs.version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get version from contants and add alpha suffix | |
id: get_version | |
run: echo "version=$(cat internal/constants/constants.go | grep Version | awk '{print $4}' | tr -d '"')-alpha.${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT | |
- name: Create tag | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: ${{ steps.get_version.outputs.version }} | |
build-cli: | |
needs: create-tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.22.5" | |
- name: Build CLI for amd64 | |
run: GOOS=linux GOARCH=arm64 go build . && mv puck puck-linux-arm64 | |
- name: Build CLI for arm64 | |
run: GOOS=linux GOARCH=amd64 go build . && mv puck puck-linux-amd64 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries | |
path: | | |
puck-linux-arm64 | |
puck-linux-amd64 | |
build-image: | |
needs: [create-tag] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
tags: ghcr.io/${{ github.repository_owner }}/puck:${{ needs.create-tag.outputs.version }}, ghcr.io/${{ github.repository_owner }}/puck:latest | |
alpha-release: | |
needs: [create-tag, build-cli, build-image] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: binaries | |
path: binaries | |
- name: Create release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
prerelease: true | |
tag_name: ${{ needs.create-tag.outputs.version }} | |
name: ${{ needs.create-tag.outputs.version }} | |
files: binaries/* |