Skip to content

feature: Adjust build targets #12

feature: Adjust build targets

feature: Adjust build targets #12

Workflow file for this run

# Copyright (c) 2024 Six After, Inc
#
# This source code is licensed under the Apache 2.0 License found in the
# LICENSE file in the root directory of this source tree.
# Ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: release
on:
workflow_dispatch:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
id-token: write
packages: write
pull-requests: read
jobs:
release:
runs-on: ubuntu-latest
env:
flags: ""
steps:
- name: "Preamble"
run: |
whoami
echo github ref $GITHUB_REF
echo workflow $GITHUB_WORKFLOW
echo home $HOME
echo event name $GITHUB_EVENT_NAME
echo workspace $GITHUB_WORKSPACE
df -h
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common ca-certificates gnupg-agent curl build-essential make
# Ref: https://github.com/actions/setup-go
- name: "Install Go"
uses: actions/setup-go@v5
with:
go-version: ">= 1.23"
# Ref: https://github.com/actions/checkout
- name: "Checkout Source"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Compute Release Flags"
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: echo "flags=--snapshot" >> $GITHUB_ENV
- name: Get Commit Hash
id: get_commit
run: |
echo "X_BUILD_COMMIT=$(git rev-parse HEAD 2> /dev/null || echo 'unknown')" >> $GITHUB_ENV
# Ref: https://github.com/goreleaser/goreleaser-action
- name: "Release"
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
X_BUILD_COMMIT: ${{ env.X_BUILD_COMMIT }}
X_GITHUB_TOKEN: ${{ secrets.GHCR_TOKEN }}