Skip to content

v0.6.13289211368

v0.6.13289211368 #7

Workflow file for this run

# Terraform Provider release workflow.
name: Release
# This GitHub action creates a release when a tag that matches the pattern
# "v*" (e.g. v0.1.0) is created.
on:
workflow_dispatch:
release:
types: [published]
# Releases need permissions to read and write the repository contents.
# GitHub considers creating releases and uploading assets as writing contents.
permissions:
contents: write
jobs:
terraform-provider-release:
name: 'Terraform Provider Release'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Check goreleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: check
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
args: release --clean
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
RELEASE_NAME: ${{ vars.RELEASE_NAME }}
verify-publications:
needs: terraform-provider-release
runs-on: ubuntu-latest
name: Verifying TF Registry Publications
strategy:
matrix:
registry:
- 'https://registry.terraform.io/v1'
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v7
env:
REGISTRY: ${{ matrix.registry }}
POLL_INTERVAL: 60000
POLL_RETRIES: 180000
with:
script: |
async function verifyPublication(targetVersion, registry) {
if (targetVersion.startsWith('v')) {
targetVersion = targetVersion.substring(1);
}
const url = `${registry}/providers/Parallels/${{ vars.RELEASE_NAME }}/versions`;
const response = await fetch(url);
if (!response.ok) {
console.log(`Error response status: ${response.status}`);
}
const json = await response.json();
return json.versions.find((v) => v.version == targetVersion) != null;
}
let prefix = "refs/tags/v";
if (!context.ref.startsWith(prefix)) {
throw new Error(`Invalid ref: ${context.ref}`);
}
const TARGET_VERSION = context.ref.slice(prefix.length);
const REGISTRY = process.env.REGISTRY;
// 1 retry request per minute, 3 hours in total
const REGISTRY_POLL_RETRIES = ${{ env.POLL_RETRIES }};
const REGISTRY_POLL_INTERVAL = ${{ env.POLL_INTERVAL }};
console.log(`Verifying publication of v${TARGET_VERSION} on ${REGISTRY}`);
let found = false;
let count = 0;
while (!found && count < REGISTRY_POLL_RETRIES) {
count++;
found = await verifyPublication(TARGET_VERSION, REGISTRY);
if (found) {
break;
}
console.log(
`Publication of v${TARGET_VERSION} on ${REGISTRY} isn't found, retrying in ${REGISTRY_POLL_INTERVAL} ms...`
);
await new Promise((r) => setTimeout(r, REGISTRY_POLL_INTERVAL));
}
if (found) {
console.log(
`Verified that Linode Provider v${TARGET_VERSION} has been successfully published on ${REGISTRY}.`
);
} else {
throw new Error(
`Timeout waiting for Linode Provider v${TARGET_VERSION} publication on ${REGISTRY}`
);
}
discord-announce:
needs: verify-publications
name: Announce on Discord
runs-on: ubuntu-latest
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
VERSION: ''
steps:
- uses: actions/checkout@v4
- name: Get version
id: get_version
run: |
VERSION=$(cat VERSION)
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
- name: Announce on discord beta
id: announce_discord_beta
if: ${{ vars.RELEASE_NAME == 'parallels-desktop-beta' }}
run: |
./.github/workflow_scripts/announce_discord.sh --repo ${{ github.repository }} --webhook-url $DISCORD_WEBHOOK --version $VERSION --beta
env:
SLACK_WEBHOOKS: ${{ env.DISCORD_WEBHOOK }}
- name: Announce on discord stable
id: announce_discord
if: ${{ vars.RELEASE_NAME == 'parallels-desktop' }}
run: |
./.github/workflow_scripts/announce_discord.sh --repo ${{ github.repository }} --webhook-url $DISCORD_WEBHOOK --version $VERSION
env:
SLACK_WEBHOOKS: ${{ env.DISCORD_WEBHOOK }}