code cleanup #5
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 | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "^1.20" | |
check-latest: true | |
- name: Cross Compile | |
run: | | |
mkdir bin | |
GOOS=linux GOARCH=amd64 go build -o ./bin/converter-linux-amd64 | |
GOOS=linux GOARCH=arm64 go build -o ./bin/converter-linux-arm64 | |
GOOS=linux GOARCH=arm GOARM=7 go build -o ./bin/converter-linux-armv7 | |
GOOS=darwin GOARCH=amd64 go build -o ./bin/converter-macos-amd64 | |
GOOS=darwin GOARCH=arm64 go build -o ./bin/converter-macos-arm64 | |
GOOS=windows GOARCH=amd64 go build -o ./bin/converter-windows-amd64.exe | |
GOOS=windows GOARCH=arm64 go build -o ./bin/converter-windows-arm64.exe | |
- uses: actions/upload-artifact@v4 | |
if: ${{ success() }} | |
with: | |
name: artifact | |
path: bin/ | |
Upload-Prerelease: | |
permissions: write-all | |
if: ${{ github.ref_type == 'branch' && !startsWith(github.event_name, 'pull_request') }} | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: bin/ | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: bin | |
- name: Delete current release assets | |
uses: 8Mi-Tech/delete-release-assets-action@main | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: Prerelease-${{ github.ref_name }} | |
deleteOnlyFromDrafts: false | |
- name: Tag Repo | |
uses: richardsimko/update-tag@v1 | |
with: | |
tag_name: Prerelease-${{ github.ref_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Prerelease | |
uses: softprops/action-gh-release@v1 | |
if: ${{ success() }} | |
with: | |
tag_name: Prerelease-${{ github.ref_name }} | |
files: | | |
bin/* | |
prerelease: true | |
generate_release_notes: true |