generated from PrivateAIM/typescript-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds steps to the release process that allow building and publishing a Docker image if a tag is present. Disables the release step if no tag is present. Resulting Docker images are published using the ghcr.io registry.
- Loading branch information
Showing
1 changed file
with
140 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,132 +1,149 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [develop, master, next, beta, alpha] | ||
pull_request: | ||
branches: [develop, master, next, beta, alpha] | ||
push: | ||
branches: [develop, master, next, beta, alpha] | ||
pull_request: | ||
branches: [develop, master, next, beta, alpha] | ||
|
||
permissions: | ||
packages: write | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
packages: write | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
|
||
env: | ||
PRIMARY_NODE_VERSION: 20 | ||
PRIMARY_NODE_VERSION: 20 | ||
|
||
jobs: | ||
install: | ||
name: Checkout and Install | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
|
||
lint: | ||
name: Lint | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Lint | ||
run: | | ||
npm run lint | ||
build: | ||
name: Build | ||
needs: [install] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
tests: | ||
name: Test | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Run tests | ||
run: | | ||
npm run test | ||
release: | ||
name: Release | ||
needs: [lint, tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
#- name: Release | ||
#env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
# | ||
# run: npx semantic-release | ||
|
||
coverage: | ||
name: Coverage | ||
needs: [release] | ||
runs-on: ubuntu-latest | ||
if: ${{ github.ref_name == 'master' }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Coverage | ||
run: | | ||
npm run test:coverage | ||
#- name: Upload report | ||
# uses: codecov/[email protected] | ||
# with: | ||
# token: ${{ secrets.codecov }} | ||
# directory: ./coverage/ | ||
install: | ||
name: Checkout and Install | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
|
||
lint: | ||
name: Lint | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Lint | ||
run: | | ||
npm run lint | ||
build: | ||
name: Build | ||
needs: [install] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
tests: | ||
name: Test | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Run tests | ||
run: | | ||
npm run test | ||
release: | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
name: Release | ||
needs: [lint, tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: GitHub Docker Registry Login | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up QEMU for multi platform builds | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Prepare Artifact Versioning Information | ||
id: prep-artifact-info | ||
run: | | ||
echo ::set-output name=repository::$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]') | ||
echo ::set-output name=version::${GITHUB_REF#refs/tags/v} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
ghcr.io/${{ steps.prep-artifact-info.outputs.repository }}:latest | ||
ghcr.io/${{ steps.prep-artifact-info.outputs.repository }}:${{ steps.prep-artifact-info.outputs.version }} | ||
coverage: | ||
name: Coverage | ||
needs: [release] | ||
runs-on: ubuntu-latest | ||
if: ${{ github.ref_name == 'master' }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install | ||
uses: ./.github/actions/install | ||
with: | ||
node-version: ${{ env.PRIMARY_NODE_VERSION }} | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Coverage | ||
run: | | ||
npm run test:coverage |