Skip to content

Deploy

Deploy #34

Workflow file for this run

name: Build CLI
on:
workflow_dispatch:
inputs:
job:
description: NPM Package
required: true
type: choice
options:
- cli
- shared
default: cli
semver:
description: Bump version
required: true
type: choice
options:
- patch
- minor
- major
default: patch
jobs:
deploy-cli:
if: ${{ github.event.inputs.job == 'cli' }}
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install deps
run: |
npm install --workspace=allure-deployer
- name: Run test
run: npm run test --workspace=packages/cli
- name: Compile
run: npm run build --workspace=packages/cli
- name: Bump version
run: |
cd packages/cli && npm version ${{github.event.inputs.semver}}
- name: NPM Publish
id: publish
uses: JS-DevTools/[email protected]
with:
token: ${{ secrets.NPM_TOKEN }}
package: packages/cli
- name: Notify Docker jobs
id: version-out
run: echo "::set-output name=version::${{ steps.publish.outputs.version}}"
- name: Add & Commit
uses: EndBug/[email protected]
with:
author_name: Sokari
author_email: [email protected]
message: "Release packages/cli version ${{steps.publish.outputs.version}}"
add: 'packages/cli/*.json'
push: 'origin main --force'
tag: 'v${{steps.publish.outputs.version}} --force'
deploy-shared:
if: ${{ github.event.inputs.job == 'shared' }}
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install deps
run: |
npm install --workspace=allure-deployer-shared
- name: Run test
run: npm run test --workspace=packages/shared
- name: Compile
run: npm run build --workspace=packages/shared
- name: Bump version
run: |
cd packages/shared && npm version ${{github.event.inputs.semver}}
- name: NPM Publish
id: publish
uses: JS-DevTools/[email protected]
with:
token: ${{ secrets.NPM_TOKEN }}
package: packages/shared
- name: Add & Commit
uses: EndBug/[email protected]
with:
author_name: Bot
author_email: [email protected]
message: "Release packages/shared version ${{steps.publish.outputs.version}}"
github_token: '${{ github.token }}'
deploy-docker-action:
if: ${{ github.event.inputs.job == 'cli' }}
runs-on: ubuntu-latest
needs: deploy-cli
steps:
- uses: actions/[email protected]
- name: Docker login
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/[email protected]
with:
context: ./packages/action
file: ./packages/action/action.Dockerfile
platforms: linux/amd64
push: true
build-args: CLI_VERSION=${{needs.deploy-cli.outputs.version}}
tags: |
sokari/allure-deployer-action:${{needs.deploy-cli.outputs.version}}
sokari/allure-deployer-action:${{ github.sha }}
deploy-docker:
if: ${{ github.event.inputs.job == 'cli' }}
runs-on: ubuntu-latest
needs: deploy-cli
steps:
- uses: actions/[email protected]
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64,amd64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker login
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/[email protected]
with:
context: ./packages/docker
file: ./packages/docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: CLI_VERSION=${{needs.deploy-cli.outputs.version}}
tags: |
sokari/allure-deployer:latest
sokari/allure-deployer:${{ github.sha }}
sokari/allure-deployer:${{needs.deploy-cli.outputs.version}}