Skip to content

Commit

Permalink
Add test changesets action
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryNguyen5 committed Nov 13, 2023
1 parent f49734c commit 31a29f0
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 0 deletions.
3 changes: 3 additions & 0 deletions actions/cicd-changesets-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# cicd-changesets

> changesets
134 changes: 134 additions & 0 deletions actions/cicd-changesets-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: cicd-changesets
description: "changesets"

inputs:
# general inputs
checkout-repo-fetch-depth:
description: "number of commits to fetch"
required: false
default: "0"
debug:
description: "debug mode"
required: false
default: "false"
git-user:
description: ""
required: false
default: app-token-issuer-infra-releng[bot]@users.noreply.github.com
git-email:
description: ""
required: false
default: app-token-issuer-infra-releng[bot]
# aws inputs
aws-role-duration-seconds:
description: ""
required: false
default: "900"
aws-region:
description: ""
required: false
aws-role-arn:
description: ""
required: false
aws-lambda-url:
description: ""
required: false
# nodejs inputs
node-version-file:
description: ""
required: false
default: ".tool-versions"
pnpm-version:
description: ""
required: false
default: "^8.0.0"
pnpm-use-cache:
description: "Use cache for pnpm"
required: false
default: "true"
# grafana cloud inputs
metrics-job-name:
description: "grafana metrics job name"
required: false
default: cicd-changesets
gc-host:
description: "grafana cloud hostname"
required: false
gc-basic-auth:
description: "grafana cloud basic auth"
required: false
# changesets inputs
changesets-publish-cmd:
description: ""
required: false
default: pnpm run ci:changeset:publish
changesets-version-cmd:
description: ""
required: false
default: pnpm run ci:changeset:version
changesets-create-gh-release:
description: ""
required: false
default: "false"

runs:
using: composite
steps:
- name: Assume aws gati role
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
role-to-assume: ${{ inputs.aws-role-arn }}
role-duration-seconds: ${{ inputs.aws-role-duration-seconds }}
aws-region: ${{ inputs.aws-region }}

- name: Get github token from gati
id: get-gh-token
uses: smartcontractkit/chainlink-github-actions/github-app-token-issuer@main
with:
url: ${{ inputs.aws-lambda-url }}

- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: ${{ inputs.checkout-repo-fetch-depth }}
token: ${{ steps.get-gh-token.outputs.access-token }}

- name: Set git config
shell: bash
run: |
git config user.email "${{ inputs.git-email }}"
git config user.name "${{ inputs.git-user }}"
- name: Setup nodejs
uses: smartcontractkit/.github/actions/setup-nodejs@main
with:
node-version-file: ${{ inputs.node-version-file }}
pnpm-version: ${{ inputs.pnpm-version }}
use-cache: ${{ inputs.pnpm-use-cache }}
run-install: "true"

- name: Push a test tag
if: ${{ inputs.debug == 'true'}}
shell: bash
run: |
tag=producer@7.7.7
git tag -a $tag -m "$tag"
- name: Run changesets
if: ${{ inputs.debug == 'false'}}
id: changesets
uses: changesets/action@f13b1baaa620fde937751f5d2c3572b9da32af23 # v1.4.5
env:
GITHUB_TOKEN: ${{ steps.get-gh-token.outputs.access-token }}
with:
publish: ${{ inputs.changesets-publish-cmd }}
version: ${{ inputs.changesets-version-cmd }}
createGithubReleases: ${{ inputs.changesets-create-gh-release }}
setupGitUser: false

- name: Check changesets output
if: ${{ inputs.debug == 'false'}}
shell: bash
run: |
echo "published: ${{ steps.changesets.outputs.published }}"
echo "publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}"
11 changes: 11 additions & 0 deletions actions/cicd-changesets-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "cicd-changesets",
"version": "0.1.0",
"description": "changesets",
"private": true,
"scripts": {},
"author": "@smartcontractkit",
"license": "MIT",
"dependencies": {},
"repository": "https://github.com/smartcontractkit/.github"
}
7 changes: 7 additions & 0 deletions actions/cicd-changesets-test/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "cicd-changesets",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "actions/cicd-changesets",
"targets": {}
}

0 comments on commit 31a29f0

Please sign in to comment.