Cleanup and conditional on release.
All checks were successful
Build Docker image / build (push) Successful in 1m0s
Build Golang packages / release (push) Has been skipped

This commit is contained in:
Pieter Hollander 2024-02-21 20:06:09 +01:00
parent 0ae503f060
commit 868805c3a8
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg

View file

@ -11,6 +11,7 @@ on:
jobs: jobs:
release: release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-docker runs-on: ubuntu-docker
steps: steps:
- name: Check out repository code - name: Check out repository code
@ -33,36 +34,9 @@ jobs:
- name: release-build-darwin-arm64 - name: release-build-darwin-arm64
run: GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-darwin-arm64 run: GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/opendtu-logger-${{ github.ref_name }}-darwin-arm64
- name: Use Go Action - name: Create release
id: use-go-action
uses: https://gitea.com/actions/release-action@main uses: https://gitea.com/actions/release-action@main
with: with:
files: |- files: |-
bin/** bin/**
api_key: '${{secrets.RELEASE_TOKEN}}' api_key: '${{secrets.RELEASE_TOKEN}}'
# - name: Create Release
# id: create_release
# env:
# GITEA_TOKEN: ${{ secrets.CI_PACKAGES_RW }}
# run: |
# RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" -H "Authorization: token ${GITEA_TOKEN}" \
# -d '{
# "tag_name": "${{ github.ref_name }}",
# "target_commitish": "main",
# "name": "Release ${{ github.ref_name }}",
# "body": "Description of the release",
# "draft": false,
# "prerelease": false
# }' \
# "https://git.hollander.online/api/v1/repos/${{ gitea.repository_owner }}/${{ gitea.event.repository.name }}/releases")
# echo "::set-output name=id::$(echo $RESPONSE | jq .id)"
# - name: Upload Assets
# env:
# GITEA_TOKEN: ${{ secrets.CI_PACKAGES_RW }}
# run: |
# for BINARY in bin/*; do
# curl -X POST -H "Authorization: token ${GITEA_TOKEN}" -H "Content-Type: application/octet-stream" --data-binary "@$BINARY" \
# "https://git.hollander.online/api/v1/repos/${{ gitea.repository_owner }}/${{ gitea.event.repository.name }}/releases/${{ steps.create_release.outputs.id }}/assets?name=$(basename $BINARY)"
# done