Merge pull request #18 from cacoco/cacoco/SetGHTOKEN #13
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: goreleaser | |
"on": | |
push: | |
tags: | |
- "*" | |
permissions: | |
contents: write | |
jobs: | |
goreleaser: | |
runs-on: ubuntu-latest | |
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: Set up Git Config | |
run: | | |
git config user.name "goreleaserbot" | |
git config user.email "<bot@goreleaser.com>" | |
- name: Update codemeta.json version in tag | |
run: | | |
# updates the codemeta.json file with the tag release version | |
TAG="${{ github.ref_name }}" | |
echo "VERSION=${TAG#v}" >> $GITHUB_ENV | |
git branch ${{ github.ref_name }}-branch | |
git checkout ${{ github.ref_name }}-branch | |
echo "`jq '.version="${{ env.VERSION }}"' codemeta.json`" > codemeta.json | |
git commit -am "[release] Update codemeta.json version" | |
git tag -d ${{ github.ref_name }} | |
git tag ${{ github.ref_name }} | |
git push --delete origin ${{ github.ref_name }} | |
git push origin ${{ github.ref_name }} | |
git checkout ${{ github.ref_name }} | |
git branch -D ${{ github.ref_name }}-branch | |
- name: Run GoReleaser | |
if: ${{ success() }} | |
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: Run Update CodeMeta JSON file action | |
if: ${{ success() }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh workflow run codemeta-version.yaml --field release_version=${{ env.VERSION }} --ref main |