diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml new file mode 100644 index 000000000..3ead0d330 --- /dev/null +++ b/.github/actions/release/action.yml @@ -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 + \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d72514e01..fe918e114 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 }} diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml deleted file mode 100644 index 2daea736d..000000000 --- a/.github/workflows/releaser.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Releaser -on: - pull_request_target: - types: [ labeled, closed ] - issue_comment: - types: [ created, edited ] - -jobs: - pr_merged: - runs-on: ubuntu-latest - name: Trigger job on comment, merge or label - steps: - - name: Trigger release - id: release - uses: RedHatInsights/frontend-releaser@v1 - with: - gh-bot-token: ${{ secrets.GH_BOT_TOKEN }} - travis-config: '{"token":"${{ secrets.TRAVIS_TOKEN }}", "script": "npm run release:bot"}' - allowed-users: '["karelhala", "ryelo", "Hyperkid123", "fhlavac", "florkbr"]' - bot-name: nacho-bot