diff --git a/actions/cicd-changesets-test/README.md b/actions/cicd-changesets-test/README.md new file mode 100644 index 00000000..7f1a3bd6 --- /dev/null +++ b/actions/cicd-changesets-test/README.md @@ -0,0 +1,3 @@ +# cicd-changesets + +> changesets diff --git a/actions/cicd-changesets-test/action.yml b/actions/cicd-changesets-test/action.yml new file mode 100644 index 00000000..36bd840e --- /dev/null +++ b/actions/cicd-changesets-test/action.yml @@ -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 }}" diff --git a/actions/cicd-changesets-test/package.json b/actions/cicd-changesets-test/package.json new file mode 100644 index 00000000..9c143ba7 --- /dev/null +++ b/actions/cicd-changesets-test/package.json @@ -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" +} diff --git a/actions/cicd-changesets-test/project.json b/actions/cicd-changesets-test/project.json new file mode 100644 index 00000000..8efcf4c4 --- /dev/null +++ b/actions/cicd-changesets-test/project.json @@ -0,0 +1,7 @@ +{ + "name": "cicd-changesets", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "application", + "sourceRoot": "actions/cicd-changesets", + "targets": {} +}