Skip to content

Add checksum generation and release asset upload to GitHub Actions workflow #18

Add checksum generation and release asset upload to GitHub Actions workflow

Add checksum generation and release asset upload to GitHub Actions workflow #18

Workflow file for this run

name: provider
permissions:
contents: write
packages: write
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build
run: |
go get .
go install github.com/mitchellh/gox@latest
go install github.com/goreleaser/goreleaser/v2@latest
make build
make checksum
- name: Archive Binaries
run: |
mkdir -p release
find bin -type f -exec cp {} release/ \;
cp checksums.txt release/
cd release
tar -czvf terraform-provider-qdrant-cloud.tar.gz *
- name: Get Latest Tag
id: get_latest_tag
uses: actions/github-script@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
const latestTag = await github.rest.repos.listTags({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 1
});
let newTag;
if (latestTag.data.length === 0) {
newTag = "v1.0.0";
} else {
const tag = latestTag.data[0].name;
const versionParts = tag.replace("v", "").split(".");
versionParts[2] = (parseInt(versionParts[2], 10) + 1).toString();
newTag = `v${versionParts.join(".")}`;
}
core.setOutput("new_tag", newTag);
- name: Import GPG key
id: import_gpg
uses: paultyng/[email protected]
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}