Clean template functions #48
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: Test and maybe create a new release | |
on: | |
push: | |
branches: [master, v3] | |
permissions: | |
contents: write | |
jobs: | |
# TODO: temporarily disable testing during alpha development | |
#test: | |
# uses: ./.github/workflows/reusable-testing.yml | |
tag: | |
runs-on: ubuntu-latest | |
#needs: test | |
outputs: | |
tag_result: ${{ steps.tag.outputs.tag_result }} | |
requested_version: ${{ steps.tag.outputs.requested_version }} | |
previous_version: ${{ steps.tag.outputs.previous_version }} | |
steps: | |
- run: sudo apt update && sudo apt install -y git && git --version | |
- uses: actions/checkout@v2 | |
with: | |
# We need entire history of tags | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: ./tools/go.mod | |
check-latest: true | |
cache-dependency-path: "**/*.sum" | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
version: 3.x | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run tagging commands | |
id: tag | |
run: | | |
set +e | |
task -x tag 1>/tmp/versions.txt | |
printf "versions: $(cat /tmp/versions.txt)\n" | |
echo "requested_version=$(cut -d',' -f 1 /tmp/versions.txt)" >> $GITHUB_OUTPUT | |
echo "previous_version=$(cut -d',' -f 2 /tmp/versions.txt)" >> $GITHUB_OUTPUT | |
tag_result="$?" | |
echo "tag_result=$tag_result" >> $GITHUB_OUTPUT | |
# The range between 8 and 63 inclusive is reserved for custom | |
# error codes that contain specific meaning. | |
if [ $tag_result -lt 8 -o $tag_result -gt 63 ]; then | |
exit $tag_result | |
fi | |
exit 0 | |
- name: Push tags | |
run: task tag.push | |
if: steps.tag.outputs.tag_result == 0 | |
release: | |
needs: tag | |
if: needs.tag.outputs.tag_result == 0 | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_CLI_EXPERIMENTAL: "enabled" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: GoReleaser | |
uses: goreleaser/[email protected] | |
with: | |
args: release --clean | |
version: "<2" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} | |
HOMEBREW_TAP_TOKEN: ${{ secrets.GORELEASER_HOMEBREW_TAP_TOKEN }} | |
GORELEASER_CURRENT_TAG: ${{ needs.tag.outputs.requested_version }} | |
#GORELEASER_PREVIOUS_TAG: ${{ needs.tag.outputs.previous_version }} |