-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0537e9eda11423dacc0046ac721e36ad3080b012
- Loading branch information
Showing
5 changed files
with
117 additions
and
12 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,95 @@ | ||
name: Release plugin to CloudQuery Hub | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
release-hub: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
env: | ||
CGO_ENABLED: 0 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-deep: 0 | ||
|
||
- name: Setup Node.js LTS | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'lts/*' | ||
- name: Install dependencies from npm | ||
run: npm i semver@^7.6 | ||
|
||
- name: Setup Go 1.x | ||
uses: actions/setup-go@v4 | ||
|
||
- name: Setup CloudQuery | ||
uses: cloudquery/setup-cloudquery@v3 | ||
with: | ||
version: v5.5.6 | ||
|
||
- name: Parse and validate semver tag | ||
id: semver-tag | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const semverParse = require("semver/functions/parse"); | ||
const input = context.ref.replace('refs/tags/', ''); | ||
const version = semverParse(input); | ||
if (!version) { | ||
throw new Error("invalid semver string") | ||
} | ||
core.setOutput("raw", version.raw); | ||
core.setOutput("version", version.version); | ||
core.setOutput("major", version.major); | ||
core.setOutput("minor", version.minor); | ||
core.setOutput("patch", version.path); | ||
core.setOutput("prerelease", version.prerelease.join(".")); | ||
core.setOutput("build", version.build.join(".")); | ||
- name: Get Release Notes | ||
id: release-notes | ||
uses: actions/github-script@v7 | ||
env: | ||
PRERELEASE: ${{ steps.semver-tag.outputs.prerelease }} | ||
with: | ||
result-encoding: string | ||
retries: 3 | ||
script: | | ||
const fs = require('node:fs'); | ||
const FILENAME = "message.txt"; | ||
const { PRERELEASE } = process.env; | ||
let message; | ||
if (PRERELEASE) { | ||
message = "This is a pre-release version of the plugin and should be used for testing purposes only"; | ||
} else { | ||
const { data } = await github.rest.repos.getReleaseByTag({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag: context.ref.replace('refs/tags/', ''), | ||
}); | ||
message = data; | ||
} | ||
fs.writeFileSync(FILENAME, message); | ||
return `@${FILENAME}`; // @ is for cloudquery cli to read from file | ||
- name: Run package command | ||
run: | | ||
go run main.go package -m ${{ steps.release-notes.outputs.result }} ${{ steps.semver-tag.outputs.version }} . | ||
- name: Publish plugin to hub | ||
env: | ||
CLOUDQUERY_API_KEY: ${{ secrets.CLOUDQUERY_API_KEY }} | ||
PRERELEASE: ${{ steps.semver-tag.outputs.prerelease }} | ||
run: | | ||
if [[ -z $PRERELEASE ]]; then | ||
cloudquery plugin publish --finalize | ||
else | ||
cloudquery plugin publish | ||
fi |
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
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 |
---|---|---|
|
@@ -33,4 +33,7 @@ changelog: | |
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
- "^test:" | ||
|
||
release: | ||
prerelease: auto |
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
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