0.0.8 #8
Workflow file for this run
This file contains hidden or 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: Release | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| release: | |
| permissions: | |
| contents: write # to upload release asset (actions/upload-release-asset) | |
| name: Release gextend-bash | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| goos: [linux, darwin] | |
| goarch: [386, amd64, arm64] | |
| exclude: | |
| - goos: darwin | |
| goarch: 386 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Set up Go | |
| uses: actions/setup-go@v2 | |
| - name: Download dependencies | |
| run: | | |
| go mod download | |
| - name: Prepare build directory | |
| run: | | |
| mkdir -p build/${{ matrix.goos }}.${{ matrix.goarch }} | |
| - name: Build | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| find cmd -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | \ | |
| while read -r target; do \ | |
| CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -trimpath -o $GITHUB_WORKSPACE/build/${{ matrix.goos }}.${{ matrix.goarch }} ./cmd/${target}; \ | |
| done | |
| cp gextend-bash-update $GITHUB_WORKSPACE/build/${{ matrix.goos }}.${{ matrix.goarch }}/gextend-bash-update | |
| - name: Create package | |
| id: package | |
| run: | | |
| PACKAGE_NAME=gextend-bash.${GITHUB_REF#refs/tags/}.${{ matrix.goos }}.${{ matrix.goarch }}.tar.gz | |
| tar -czvf $PACKAGE_NAME -C build/${{ matrix.goos }}.${{ matrix.goarch }} . | |
| echo ::set-output name=name::${PACKAGE_NAME} | |
| - name: Upload asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./${{ steps.package.outputs.name }} | |
| asset_name: ${{ steps.package.outputs.name }} | |
| asset_content_type: application/gzip |