Skip to content

Merge pull request #26 from cacoco/lat #21

Merge pull request #26 from cacoco/lat

Merge pull request #26 from cacoco/lat #21

Workflow file for this run

name: goreleaser
"on":
push:
tags:
- "*"
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
outputs:
release-version: ${{ steps.get_release_version.outputs.release-version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Get release version from tag -- saves to current environment context
run: |
tag="${{ github.ref_name }}"
echo "release-version=${tag#v}" >> $GITHUB_ENV
- name: Update codemeta.json version
uses: jossef/action-set-json-field@v2.1
with:
file: codemeta.json
field: version
value: "${{ env.release-version }}"
- name: Set up Git Config
run: |
git config user.name "goreleaserbot"
git config user.email "<bot@goreleaser.com>"
- name: Commit updated codemeta.json file in the current tag
run: |
# save the codemeta.json file changes to the current tag
git branch ${{ github.ref_name }}-branch
git checkout ${{ github.ref_name }}-branch
# commit changes
git commit -am "[release] Update codemeta.json version"
# delete and recreate tag with the above commit
git tag -d ${{ github.ref_name }}
git tag ${{ github.ref_name }}
# push the recreated tag to origin
git push --delete origin ${{ github.ref_name }}
git push origin ${{ github.ref_name }}
# delete the temporary branch
git checkout ${{ github.ref_name }}
git branch -D ${{ github.ref_name }}-branch
# - name: Run GoReleaser
# uses: goreleaser/goreleaser-action@v5
# with:
# distribution: goreleaser
# version: latest
# args: release --clean
# env:
# # need to push to cacoco/homebrew-tap; use CACOCO_TOKEN instead of default GITHUB_TOKEN
# GITHUB_TOKEN: ${{ secrets.CACOCO_TOKEN }}
# GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: get_release_version -- saves to github output context
run: |
tag="${{ github.ref_name }}"
echo "release-version=${tag#v}" >> $GITHUB_OUTPUT
call-codemeta-version:
needs: [goreleaser]
uses: ./.github/workflows/codemeta-version.yaml
with:
release-version: ${{ needs.goreleaser.outputs.release-version }}
secrets: inherit