add write permissions #19
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: Build and Release | |
on: | |
push: | |
branches: | |
- "*" | |
tags: | |
- "*" | |
permissions: | |
contents: write | |
env: | |
LINUX_AMD_ARCHIVE: sourceprompt-${{ github.ref_name }}-linux-amd64.tar.gz | |
LINUX_ARM_ARCHIVE: sourceprompt-${{ github.ref_name }}-linux-arm64.tar.gz | |
WIN_AMD_ARCHIVE: sourceprompt-${{ github.ref_name }}-win-amd64.zip | |
MAC_ARM_ARCHIVE: sourceprompt-${{ github.ref_name }}-mac-arm64.tar.gz | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.22.0 | |
- name: Build Binaries | |
id: build | |
run: | | |
echo "ref -> $GITHUB_REF" | |
echo "----- Building Linux amd64 binary" | |
GOOS=linux GOARCH=amd64 go build -o sourceprompt ./... | |
tar -czvf ${LINUX_AMD_ARCHIVE} sourceprompt | |
rm -v sourceprompt | |
echo "----- Building Linux arm64 binary" | |
GOOS=linux GOARCH=arm64 go build -o sourceprompt ./... | |
tar -czvf ${LINUX_ARM_ARCHIVE} sourceprompt | |
rm -v sourceprompt | |
echo "----- Building Windows amd64 binary" | |
GOOS=windows GOARCH=amd64 go build -o sourceprompt.exe ./... | |
zip ${WIN_AMD_ARCHIVE} sourceprompt.exe | |
rm -v sourceprompt.exe | |
echo "----- Building Mac arm64 binary" | |
GOOS=darwin GOARCH=arm64 go build -o sourceprompt ./... | |
tar -czvf ${MAC_ARM_ARCHIVE} sourceprompt | |
rm -v sourceprompt | |
ls -lah | |
- name: Create Release and Upload Artifacts | |
if: startsWith(github.ref, 'refs/tags/') | |
id: create_release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: false | |
title: "sourceprompt ${{ github.ref_name }}" | |
files: | | |
*.tar.gz | |
*.zip |