Skip to content

fix: update workflow #12

fix: update workflow

fix: update workflow #12

Workflow file for this run

name: Build go-calculator
on:
push:
branches: [master]
tags:
- v0.*
- v1.*
pull_request:
branches: [master]
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.21"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: dependencies
run: go get
- name: lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --no-config --out-format github-actions --disable-all --enable errcheck
install-mode: goinstall
- name: Build
id: build
env:
dir: ${{ github.workspace }}
run: |
script="${{ env.dir }}/build-package"
chmod +x "${script}"
source ${script}
build_binary ${{ env.dir }}
- name: uploadArtifact
uses: actions/upload-artifact@v3
if: success()
with:
name: go-calculator
path: /opt/artifacts/go-calculator.gzip
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: download binary
uses: actions/download-artifact@v3
id: download
with:
name: go-calculator
- name: Upload Release
env:
dir: ${{ github.workspace }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
TAG: ${{ github.ref_type == 'tag' && github.event.ref || github.event.commits.id }}
if: success()
run: |
export GH_TOKEN="${{ env.GH_TOKEN }}"
export REPOSITORY="${{ env.REPOSITORY }}"
export TAG="${{ env.TAG }}"
export BINARY=go-calculator.gzip
script="${{ env.dir }}/build-package"
source ${script}
upload_release