feat: add --version flag #83
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: Workflow | |
on: [push] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: brunnerlivio/tsp-web | |
jobs: | |
"build": | |
strategy: | |
matrix: | |
version: | |
[ | |
# Windows | |
{ NAME: "Windows amd64", GOOS: "windows", GOARCH: "amd64", GOARM: "", OUTPUT: ".bin/tsp-web.exe" }, | |
# Linux | |
{ NAME: "Linux amd64", GOOS: "linux", GOARCH: "amd64", GOARM: "", OUTPUT: ".bin/tsp-web_linux_amd64" }, | |
{ NAME: "Linux arm64", GOOS: "linux", GOARCH: "arm64", GOARM: "", OUTPUT: ".bin/tsp-web_linux_arm64" }, | |
{ NAME: "Linux armv5", GOOS: "linux", GOARCH: "arm", GOARM: "5", OUTPUT: ".bin/tsp-web_linux_armv5" }, | |
{ NAME: "Linux armv7", GOOS: "linux", GOARCH: "arm", GOARM: "7", OUTPUT: ".bin/tsp-web_linux_armv7" }, | |
# Mac | |
{ NAME: "Darwin arm64", GOOS: "darwin", GOARCH: "arm64", GOARM: "", OUTPUT: ".bin/tsp-web_darwin_arm64" }, | |
{ NAME: "Darwin amd64", GOOS: "darwin", GOARCH: "amd64", GOARM: "", OUTPUT: ".bin/tsp-web_darwin_amd64" } | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.19" | |
- name: Install dependencies | |
run: make install | |
- name: Build ${{ matrix.version.NAME }} | |
run: GOOS=${{ matrix.version.GOOS }} GOARCH=${{ matrix.version.GOARCH }} GOARM=${{ matrix.version.GOARM }} go build -o ${{ matrix.version.OUTPUT }} ./main.go | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "tsp-web" | |
path: | | |
.bin/* | |
"docker-build": | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
"semantic-release": | |
runs-on: ubuntu-latest | |
needs: ["build", "docker-build"] | |
permissions: | |
contents: write | |
packages: write | |
pages: write | |
id-token: write | |
issues: write | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
cache: npm | |
- uses: actions/download-artifact@master | |
with: | |
name: "tsp-web" | |
- name: Install dependencies | |
run: npm ci | |
- run: docker build --tag ${{ env.IMAGE_NAME }} . | |
- name: Semantic Release | |
run: npm run semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
DOCKER_USERNAME: ${{ github.actor }} | |
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }} |