| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- name: Release
- # Controls when the workflow will run
- on:
- # Triggers the workflow on push or pull request events but only for the main branch
- push:
- branches: [ main ]
- #tags:
- # - '*'
- pull_request:
- branches: [ main ]
- release:
- types: [published]
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
- jobs:
- build:
- strategy:
- matrix:
- # Include amd64 on Linux and drawin.
- goos: [linux, darwin]
- goarch: [amd64, 386]
- exclude:
- # Exclude i386 on darwin.
- - goarch: 386
- goos: darwin
- include:
- - goos: darwin
- goarch: arm64
- - goos: linux
- goarch: arm64
- fail-fast: false
- runs-on: ubuntu-latest
- env:
- GOOS: ${{ matrix.goos }}
- GOARCH: ${{ matrix.goarch }}
- GOARM: ${{ matrix.goarm }}
- CGO_ENABLED: 0
- steps:
- - name: Checkout
- uses: actions/checkout@v2
- - name: Setup Go
- uses: actions/setup-go@v2
- with:
- go-version: 1.17
-
- - name: Get project dependencies
- run: go mod download
- - name: Build
- run: |
- mkdir -p build_assets
- go build -v -o build_assets/oci-help -trimpath -ldflags "-s -w -buildid=" ./...
- - name: Show workflow information
- id: get_filename
- run: |
- export _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM\"].friendlyName" -r < .github/build/friendly-filenames.json)
- echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, RELEASE_NAME: $_NAME"
- echo "::set-output name=ASSET_NAME::$_NAME"
- echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV
- - name: Create ZIP archive
- run: |
- pushd build_assets || exit 1
- zip -9vr ../oci-help-$ASSET_NAME.zip .
- popd || exit 1
- FILE=./oci-help-$ASSET_NAME.zip
- DGST=$FILE.dgst
- for METHOD in {"md5","sha1","sha256","sha512"}
- do
- openssl dgst -$METHOD $FILE | sed 's/([^)]*)//g' >>$DGST
- done
- - name: Upload ZIP file to Artifacts
- uses: actions/upload-artifact@v2
- with:
- name: oci-help-${{ steps.get_filename.outputs.ASSET_NAME }}.zip
- path: oci-help-${{ steps.get_filename.outputs.ASSET_NAME }}.zip
- - name: Upload Release
- uses: softprops/action-gh-release@v1
- if: startsWith(github.ref, 'refs/tags/')
- with:
- files: ./oci-help-${{ steps.get_filename.outputs.ASSET_NAME }}.zip*
- #draft: true
- #prerelease: true
|