Skip to content

Commit

Permalink
Enable releasing beta versions of provider (#489)
Browse files Browse the repository at this point in the history
* Add ability to release beta versions of providers

* Support setting up ref
  • Loading branch information
michalg9 authored Dec 14, 2023
1 parent 6f66a70 commit 4d3a072
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/release-beta.yml
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 }}

0 comments on commit 4d3a072

Please sign in to comment.