fix: release on tag push (#694) #7
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: Release Pipeline | |
on: | |
push: | |
tags: ["**"] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [linux, windows, darwin, freebsd] | |
arch: [amd64, arm64, arm] | |
exclude: | |
- os: darwin | |
arch: arm | |
- os: windows | |
arch: arm | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Get the current commit | |
id: get_commit | |
run: echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: Get the current date | |
id: get_date | |
run: echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT | |
- name: Build binary | |
run: | | |
VERSION=${{ github.ref_name }} | |
COMMIT=${{ steps.get_commit.outputs.commit }} | |
DATE=${{ steps.get_date.outputs.date }} | |
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} CGO_ENABLED=0 go build -o immich-go-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.os == 'windows' && '.exe' || '' }} -ldflags="-s -w -extldflags=-static -X version.Version=$VERSION -X version.Commit=$COMMIT -X version.Date=$DATE" main.go | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-${{ matrix.arch}} | |
path: "./immich-go-*" | |
if-no-files-found: error | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: "./artifacts" | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: "./artifacts/**" | |
draft: false | |
prerelease: false |