Skip to content

update build

update build #42

Workflow file for this run

name: Build go-calculator
on:
push:
tags:
- v0.*
- v1.*
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 }}
cache: false
- 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
skip-cache: true
- 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
if-no-files-found: error
retention-days: 5
release:
runs-on: ubuntu-latest
permissions: write-all
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_name }}
if: success()
run: |
set -x
export GH_TOKEN="${{ env.GH_TOKEN }}"
export REPOSITORY="${{ env.REPOSITORY }}"
export TAG="${{ env.TAG }}"
script="${{ env.dir }}/build-package"
source ${script}
get_last_release
if [[ "${tag_name}" != "${TAG}" ]]; then
create_relase
fi
cd ${{ steps.download.outputs.download-path }}
recurse_dir