Merge pull request #520 from crazy-max/gha-perms #262
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: build | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions | |
permissions: | |
contents: read | |
on: | |
pull_request: | |
branches: | |
- 'master' | |
push: | |
branches: | |
- 'master' | |
tags: | |
- '*.*.*' | |
env: | |
VERSION: "0.0.0" | |
jobs: | |
release: | |
runs-on: windows-latest | |
permissions: | |
# required to create GitHub release | |
contents: write | |
steps: | |
- | |
name: Prepare | |
run: | | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
cache: true | |
- | |
name: Mage build | |
uses: magefile/mage-action@v2 | |
with: | |
version: latest | |
args: build | |
- | |
name: Mage chocoPack | |
uses: magefile/mage-action@v2 | |
with: | |
version: latest | |
args: chocoPack | |
- | |
name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: WindowsSpyBlocker | |
path: | | |
bin/WindowsSpyBlocker.exe | |
bin/windowsspyblocker.${{ env.VERSION }}.nupkg | |
- | |
name: GitHub Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: true | |
files: | | |
bin/WindowsSpyBlocker.exe | |
bin/windowsspyblocker.${{ env.VERSION }}.nupkg | |
name: ${{ env.VERSION }} | |
- | |
name: Mage chocoPush | |
uses: magefile/mage-action@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }} | |
with: | |
version: latest | |
args: chocoPush |