[Feature] add CI/CD pipeline to build and distribuite the binary artifact #50
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
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Go | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
jobs: | |
dump_tag: | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.create_release.outputs.id }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Bump release version and push tag | |
id: release | |
uses: anothrNick/github-tag-action@1.64.0 # Don't use @master or @v1 unless you're happy to test the latest version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # if you don't want to set write permissions use a PAT token | |
WITH_V: false | |
PRERELEASE: false | |
- name: get the latest tag | |
id: tag | |
run: | | |
latest_tag=$(git describe --tags --abbrev=0) | |
echo "tag_name=$latest_tag" >> $GITHUB_OUTPUT | |
- name: create release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
tag: ${{ steps.tag.outputs.tag_name }} | |
name: ${{ steps.tag.outputs.tag_name }} | |
draft: false | |
prerelease: false | |
unix: | |
runs-on: ubuntu-latest | |
needs: dump_tag | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
- name: Build samora | |
run: go build -o "samora" ./main.go | |
- name: Upload the sml unix asset | |
id: unix-release-asset | |
uses: basefas/upload-release-asset-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ needs.dump_tag.outputs.release_id }} | |
asset_path: samora | |
asset_name: samora-lang | |
win: | |
runs-on: windows-latest | |
needs: dump_tag | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
- name: Build samora.exe | |
run: go build -o "samora.exe" ./main.go | |
- name: Upload samora.exe asset | |
id: windows-release-asset | |
uses: basefas/upload-release-asset-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ needs.dump_tag.outputs.release_id }} | |
asset_path: samora.exe | |
asset_name: samora-lang-win.exe |