Update .goreleaser.yml #35
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_Workflow | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
Code_Analysis_Job: | |
runs-on: ubuntu-latest | |
environment: test | |
steps: | |
- | |
name: Check out repository code | |
uses: actions/checkout@v4 | |
- | |
name: Fetching GO version from repo | |
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV | |
- | |
name: Setup GO environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- | |
name: Code linter | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
args: -v | |
- | |
name: Running acceptace test | |
run: TF_ACC=1 go test -v ./... | |
env: | |
ULTRADNS_UNIT_TEST_USERNAME: ${{ secrets.ULTRADNS_UNIT_TEST_USERNAME }} | |
ULTRADNS_UNIT_TEST_PASSWORD: ${{ secrets.ULTRADNS_UNIT_TEST_PASSWORD }} | |
ULTRADNS_UNIT_TEST_HOST_URL: ${{ secrets.ULTRADNS_UNIT_TEST_HOST_URL }} | |
ULTRADNS_UNIT_TEST_USER_AGENT: ${{ secrets.ULTRADNS_UNIT_TEST_USER_AGENT }} | |
ULTRADNS_UNIT_TEST_NAME_SERVER: ${{ secrets.ULTRADNS_UNIT_TEST_NAME_SERVER }} | |
ULTRADNS_UNIT_TEST_SECONDARY_ZONE_NAME: ${{ secrets.ULTRADNS_UNIT_TEST_SECONDARY_ZONE_NAME }} | |
ULTRADNS_UNIT_TEST_ACCOUNT: ${{ secrets.ULTRADNS_UNIT_TEST_ACCOUNT }} | |
Release_Job: | |
runs-on: ubuntu-latest | |
needs: Code_Analysis_Job | |
environment: prod | |
steps: | |
- | |
name: Check out repository code | |
uses: actions/checkout@v4 | |
- | |
name: Fetching GO version from repo | |
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV | |
- | |
name: Setup GO environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- | |
name: Create Release Info | |
run: echo "RELEASE_VERSION=$(cat .plugin-version)" >> $GITHUB_ENV | |
- | |
name: Update release version using go generate | |
run: go generate ./internal/version | |
- | |
name: Setup git config for creating Tag | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "<>" | |
- | |
name: Update sdk version and create Tag | |
run: | | |
git add internal/version/version_generated.go | |
git commit -m "version updated" | |
git tag ${{ env.RELEASE_VERSION }} | |
git push origin ${{ env.RELEASE_VERSION }} | |
- | |
name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
- | |
name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: "~> v2" | |
args: release --clean | |
env: | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |