Skip to content

Commit

Permalink
Merge pull request #2105 from Hyperkid123/unify-release-workflow
Browse files Browse the repository at this point in the history
chore: move release action into composite action
  • Loading branch information
Hyperkid123 authored Nov 19, 2024
2 parents d3039de + ab580b8 commit 0e47f9a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 58 deletions.
54 changes: 54 additions & 0 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release job
description: build affected packages and publish them to npm
inputs:
npm_token:
description: 'NPM token'
required: true
gh_token:
description: 'Github token'
required: true
gh_name:
description: 'Github name'
required: true
gh_email:
description: 'Github email'
required: true
runs:
using: "composite"
steps:
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: nrwl/nx-set-shas@v4
- uses: './.github/actions/cache'
- name: Install deps
shell: bash
run: npm i
- name: git config
shell: bash
run: |
git config user.name "${{ inputs.gh_name }}"
git config user.email "${{ inputs.gh_email }}"
- name: Build
shell: bash
run: npx nx run-many -t build --exclude=demo,
- name: Set publish config
env:
NPM_TOKEN: ${{ inputs.npm_token }}
shell: bash
run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
- name: Version
shell: bash
env:
# skip the git hooks
HUSKY: 0
GH_TOKEN: ${{ inputs.gh_token }}
GITHUB_TOKEN: ${{ inputs.gh_token }}
run: npx nx affected --base=last-release --parallel=1 --target=version --trackDeps --exclude=@redhat-cloud-services/executors,demo
- name: Tag last-release
shell: bash
run: |
git tag -f last-release
git push origin last-release --force --no-verify
45 changes: 7 additions & 38 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,44 +123,13 @@ jobs:
needs: [install, build, unit-test, component-test, lint, commitlint, check-circular-imports]
if: github.event_name != 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.BOT_AUTH_KEY }}
# token: ${{ secrets.GH_BOT_TOKEN }}
- name: Use Node.js 20.x
uses: actions/setup-node@v3
ssh-key: ${{ secrets.BOT_AUTH_KEY}}
- uses: './.github/actions/release'
with:
node-version: 20.x
- uses: nrwl/nx-set-shas@v4
- uses: './.github/actions/cache'
- name: Install deps
shell: bash
run: npm i
- name: Rebuild packages
run: npm run build
- name: git config
shell: bash
run: |
git config user.name "Hyperkid123"
git config user.email "${{ secrets.BOT_EMAIL }}"
- name: Set publish config
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
shell: bash
run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
- name: Release packages
shell: bash
env:
# skip the git hooks
HUSKY: 0
GH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
run: npx nx affected --base=last-release --parallel=1 -t version --trackDeps --baseBranch=master
- name: Tag last-release
shell: bash
run: |
git tag -f last-release
git push origin last-release --force --no-verify
git push origin master --no-verify
gh_token: ${{ secrets.GH_BOT_TOKEN }}
npm_token: ${{ secrets.NPM_TOKEN }}
gh_name: Hyperkid123
gh_email: ${{ secrets.BOT_EMAIL }}
20 changes: 0 additions & 20 deletions .github/workflows/releaser.yml

This file was deleted.

0 comments on commit 0e47f9a

Please sign in to comment.