-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable releasing beta versions of provider (#489)
* Add ability to release beta versions of providers * Support setting up ref
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Release beta | ||
|
||
# Beta releases are triggered manually to a specific provider from spacelift-io inputs | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
providerType: | ||
description: 'Provider type' | ||
required: true | ||
ref: | ||
description: 'The branch, tag or SHA to use' | ||
required: true | ||
|
||
jobs: | ||
goreleaser: | ||
name: Release beta | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Validation for provider type | ||
if: ${{ inputs.providerType == 'spacelift' }} | ||
run: | | ||
echo "It is not possible to release a provider with the name 'spacelift' to the Spacelift registry using manual workflow." | ||
exit 1 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: { go-version: 1.19 } | ||
|
||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v5 | ||
id: import_gpg | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
|
||
- name: Run GoReleaser to create draft release | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
version: latest | ||
args: release --clean --snapshot | ||
env: | ||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install spacectl | ||
uses: spacelift-io/setup-spacectl@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Release to Spacelift registry (preprod) | ||
run: spacectl provider create-version --type=${{ inputs.providerType }} | ||
env: | ||
GPG_KEY_ID: ${{ steps.import_gpg.outputs.keyid }} | ||
SPACELIFT_API_KEY_ENDPOINT: https://spacelift-io.app.spacelift.dev | ||
SPACELIFT_API_KEY_ID: ${{ secrets.SPACELIFT_PREPROD_API_KEY_ID }} | ||
SPACELIFT_API_KEY_SECRET: ${{ secrets.SPACELIFT_PREPROD_API_KEY_SECRET }} | ||
|
||
- name: Release to Spacelift registry (prod) | ||
run: spacectl provider create-version --type=${{ inputs.providerType }} | ||
env: | ||
GPG_KEY_ID: ${{ steps.import_gpg.outputs.keyid }} | ||
SPACELIFT_API_KEY_ENDPOINT: https://spacelift-io.app.spacelift.io | ||
SPACELIFT_API_KEY_ID: ${{ secrets.SPACELIFT_PROD_API_KEY_ID }} | ||
SPACELIFT_API_KEY_SECRET: ${{ secrets.SPACELIFT_PROD_API_KEY_SECRET }} |