-
Notifications
You must be signed in to change notification settings - Fork 84
ci: release workflow #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: release workflow #106
Changes from 4 commits
66ef9e0
cddfde9
4317768
bf924d7
626b996
64c43e2
6de490e
eba02b2
32e32ec
908098c
1a3356c
d9fd843
7bd4114
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Resolve version | ||
description: Read "version" of "@tutorialkit/astro" to "steps.resolve-release-version.outputs.version" | ||
|
||
outputs: | ||
version: | ||
description: 'Version of @tutorialkit/astro' | ||
value: ${{ steps.resolve-release-version.outputs.version }} | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Resolve release version | ||
id: resolve-release-version | ||
shell: bash | ||
run: echo "version=$(jq -r .version ./packages/astro/package.json)" >> $GITHUB_OUTPUT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Setup and build | ||
description: Generic setup action for actions | ||
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
inputs: | ||
node-version: | ||
required: false | ||
description: Node version for setup-node | ||
default: 20.x | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Set node version to ${{ inputs.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
|
||
- name: Install & Build | ||
shell: bash | ||
run: | | ||
pnpm install | ||
pnpm build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Integration Tests CLI | ||
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
cli-integration-test: | ||
name: CLI Integration Tests | ||
# Note: `prepare-release.yaml` sets this commit message | ||
if: ${{ contains(github.event.pull_request.title, 'release tutorialkit CLI') }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/setup-and-build | ||
|
||
- name: Update template's versions | ||
working-directory: ./packages/cli | ||
run: pnpm update-template | ||
|
||
- name: Integration Tests | ||
working-directory: ./integration | ||
run: pnpm test |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Prepare release PR | ||
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to publish, e.g. 0.0.1' | ||
required: true | ||
default: '0.0.1' | ||
type: string | ||
|
||
jobs: | ||
prepare_release: | ||
name: Prepare release PR | ||
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/setup-and-build | ||
|
||
- name: Bump versions | ||
run: > | ||
pnpm --recursive | ||
--filter "@tutorialkit/*" | ||
exec pnpm version --no-git-tag-version --allow-same-version ${{ inputs.version }} | ||
|
||
- name: Generage changelog | ||
run: pnpm run changelog | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
# Note: `publish-release.yaml` checks explicitly for this commit message | ||
commit-message: 'chore: release @tutorialkit packages, version: ${{ inputs.version }}' | ||
title: 'chore: release @tutorialkit packages, version: ${{ inputs.version }}' | ||
body: 'Bump packages to version ${{ inputs.version }} and generate changelogs' | ||
reviewers: SamVerschueren,d3lm,Nemikolh,AriPerkkio | ||
branch: chore/release-${{ inputs.version }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
name: Publish release | ||
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish_release: | ||
name: Publish release | ||
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
id-token: write | ||
Comment on lines
+12
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are required for |
||
# Note: `prepare-release.yaml` sets this commit message | ||
if: ${{ contains(github.event.head_commit.message, 'release @tutorialkit packages') }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/setup-and-build | ||
|
||
# Sets steps.resolve-release-version.outputs.version | ||
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- uses: ./.github/actions/resolve-release-version | ||
id: resolve-release-version | ||
|
||
- name: Publish to npm | ||
run: > | ||
pnpm --recursive | ||
--filter "@tutorialkit/*" | ||
exec pnpm publish --provenance | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
Comment on lines
+34
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll need to manually add this secret to the project. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @d3lm I think if you can add @stackblitz-gitops to the packages, then we should be able to reuse the token of @stackblitz-gitops. @apai4 Do you think that would be fine? Or should we have a different token? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I pinged Pai about this because I cannot add NPM access tokens since I don't have permissions to generate them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll create a new token for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The token has been created and added to the repo. Let me know if it works once There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @d3lm can you grant access to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I can do that! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Invite is out. I think @apai4 needs to accept it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @d3lm do you have permissions to check if this is completed now? Publish step failed at https://github.com/stackblitz/tutorialkit/actions/runs/9791481416/job/27035364611 |
||
|
||
- name: Create and push git tag | ||
run: | | ||
git config --global user.name 'github-actions' | ||
git config --global user.email '[email protected]' | ||
git tag v${{ steps.resolve-release-version.outputs.version }} | ||
git push origin v${{ steps.resolve-release-version.outputs.version }} | ||
|
||
prepare_cli_release: | ||
name: Prepare release for CLI | ||
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
needs: [publish_release] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/setup-and-build | ||
|
||
# Sets steps.resolve-release-version.outputs.version | ||
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- uses: ./.github/actions/resolve-release-version | ||
id: resolve-release-version | ||
|
||
- name: Bump version | ||
run: > | ||
pnpm --recursive | ||
--filter tutorialkit | ||
--filter create-tutorial | ||
exec npm version --no-git-tag-version --allow-same-version ${{ steps.resolve-release-version.outputs.version }} | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
# Note: `publish-release.yaml` checks explicitly for this commit message | ||
commit-message: 'chore: release tutorialkit CLI, version: ${{ steps.resolve-release-version.outputs.version }}' | ||
title: 'chore: release tutorialkit CLI, version: ${{ steps.resolve-release-version.outputs.version }}' | ||
body: 'Bump tutorialkit CLI to version ${{ steps.resolve-release-version.outputs.version }}' | ||
reviewers: SamVerschueren,d3lm,Nemikolh,AriPerkkio | ||
branch: chore/release-cli-${{ steps.resolve-release-version.outputs.version }} | ||
|
||
publish_release_CLI: | ||
name: Publish release CLI | ||
AriPerkkio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
id-token: write | ||
# Note: `prepare-release.yaml` sets this commit message | ||
if: ${{ contains(github.event.head_commit.message, 'release tutorialkit CLI') }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/setup-and-build | ||
|
||
- name: Update template's versions | ||
working-directory: ./packages/cli | ||
run: pnpm update-template | ||
|
||
- name: Integration Tests | ||
working-directory: ./integration | ||
run: pnpm test | ||
|
||
- name: Publish to npm | ||
run: > | ||
pnpm --recursive | ||
--filter tutorialkit | ||
--filter create-tutorial | ||
exec pnpm publish --provenance | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
Uh oh!
There was an error while loading. Please reload this page.