Skip to content

Commit

Permalink
Amending the release process
Browse files Browse the repository at this point in the history
  • Loading branch information
jtyr committed Apr 20, 2021
1 parent fb24d04 commit bbf5af5
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:

jobs:
validate:
name: Validate source code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -35,6 +36,7 @@ jobs:
run: go build -v ./...

build:
name: Build artifacts
if: startsWith(github.ref, 'refs/tags/v')
needs: validate
runs-on: ubuntu-latest
Expand Down Expand Up @@ -82,9 +84,10 @@ jobs:
run: |
echo ::set-output name=tag_name::${GITHUB_REF#refs/tags/v}
- name: Create output directory
- name: Get file name
id: file
run: |
mkdir -p /tmp/files
echo ::set-output name=file_name::gcapi-cli-${{ steps.tag.outputs.tag_name }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.arm }}${{ matrix.extension }}
- name: Build
run: >
Expand All @@ -94,12 +97,36 @@ jobs:
CGO_ENABLED=0
go build
-ldflags='-s -w -X github.com/jtyr/gcapi/pkg/version.Version=${{ steps.tag.outputs.tag_name }}'
-o /tmp/files/gcapi-cli-${{ steps.tag.outputs.tag_name }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.arm }}${{ matrix.extension }}
-o /tmp/${{ steps.file.outputs.file_name }}
./main.go
- name: Create checksums file
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: gcapi-cli-${{ steps.tag.outputs.tag_name }}
path: /tmp/${{ steps.file.outputs.file_name }}
retention-days: 1

release:
name: Release all built artifacts
needs: build
runs-on: ubuntu-latest
steps:
- name: Get tag name
id: tag
run: |
echo ::set-output name=tag_name::${GITHUB_REF#refs/tags/v}
- name: Download all workflow artifacts
uses: actions/download-artifact@v2
with:
name: gcapi-cli-${{ steps.tag.outputs.tag_name }}
path: /tmp/files

- name: Create checksum file
run: |
sha256sum /tmp/files/* | sort -k2 > "gcapi-cli-${{ steps.tag.outputs.tag_name }}-checksums-sha256.txt"
cd /tmp/files
sha256sum * | sort -k2 > gcapi-cli-${{ steps.tag.outputs.tag_name }}-checksums-sha256.txt
- name: Release
uses: softprops/action-gh-release@v1
Expand Down

0 comments on commit bbf5af5

Please sign in to comment.