Skip to content

Commit

Permalink
refactor changesets release preview workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
momentmaker committed May 3, 2024
1 parent a6b8ddf commit 56ae127
Showing 1 changed file with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
#
# This action creates or updates a Release Preview PR that shows which changes are going to be part of the next release
# when a PR is merged into develop branch
# This action creates or updates a Release Preview PR that shows which changes are going to be part of the next release.
#

name: Release Preview - Changeset

on:
push:
branches:
- develop
- re-2590/refactor-changesets-release-preview # remove after testing
# - develop

jobs:
cicd-changesets:
changesets-release-preview:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
actions: read
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changeset-added
id: change
with:
token: ${{ secrets.GITHUB_TOKEN }}
filters: |
core-changeset:
- added: '.changeset/**'
- '.changeset/**'
- name: Setup pnpm
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
Expand All @@ -43,32 +42,34 @@ jobs:
cache: pnpm
cache-dependency-path: ./pnpm-lock.yaml

- name: Run changeset version
run: pnpm install && pnpm changeset version
- name: Generate new changelog
if: steps.changeset-added.outputs.core-changeset == 'true'
run: pnpm install && ./tools/ci/format_changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: steps.changeset-added.outputs.core-changeset == 'true'

- name: Get release version
if: steps.changeset-added.outputs.core-changeset == 'true'
id: get-release-version
run: echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT

- name: cicd-changesets
- name: Create release preview PR
if: steps.changeset-added.outputs.core-changeset == 'true'
uses: smartcontractkit/.github/actions/cicd-changesets@6da79c7b9f14bec077df2c1ad40d53823b409d9c # [email protected]
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
with:
# general inputs
git-user: app-token-issuer-releng[bot]
git-email: app-token-issuer-releng[bot]@users.noreply.github.com
pnpm-use-cache: false
pr-draft: true
pr-title: "[DO NOT MERGE] Changeset Release Preview - v${{ steps.get-release-version.outputs.version }}"
# aws inputs
aws-region: ${{ secrets.AWS_REGION }}
aws-role-arn: ${{ secrets.AWS_OIDC_CHAINLINK_CI_AUTO_PR_TOKEN_ISSUER_ROLE_ARN }}
aws-lambda-url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }}
# grafana inputs
gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }}
gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
add-paths: |
.changeset/**
CHANGELOG.md
commit-message: "changeset: release preview"
committer: app-token-issuer-releng[bot] <app-token-issuer-releng[bot]@users.noreply.github.com>
branch: changesets/release-preview
title: "[DO NOT MERGE] Changeset Release Preview - v${{ steps.get-release-version.outputs.version }}"
body: |
This PR is a preview of the changes that will be included in the next release. Please do not merge this PR.
<!--
This PR was created by the changesets-release-preview workflow.
-->
draft: true
labels: |
release-preview
do-not-merge

0 comments on commit 56ae127

Please sign in to comment.