-
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.
- Loading branch information
1 parent
92de239
commit b3850f1
Showing
12 changed files
with
980 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_call: | ||
|
||
permissions: | ||
checks: write | ||
contents: write | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
id: setup | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
id: dependencies | ||
run: npm ci | ||
|
||
- id: build | ||
name: Build | ||
run: npm run build |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: 'Lint' | ||
|
||
on: | ||
workflow_call: | ||
|
||
permissions: | ||
checks: write | ||
contents: write | ||
|
||
jobs: | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
id: setup | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
id: dependencies | ||
run: npm ci | ||
|
||
- name: Lint | ||
id: lint | ||
run: npm run lint |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: 'PR' | ||
|
||
on: | ||
pull_request: | ||
|
||
permissions: | ||
checks: write | ||
contents: write | ||
|
||
jobs: | ||
|
||
lint: | ||
name: Lint | ||
uses: ./.github/workflows/lint.yml | ||
|
||
build: | ||
name: Build | ||
uses: ./.github/workflows/build.yml |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: 'Publish to Docker Hub' | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
type: string | ||
description: 'The version to publish' | ||
required: true | ||
|
||
secrets: | ||
DOCKER_USERNAME: | ||
required: true | ||
DOCKERHUB_TOKEN: | ||
required: true | ||
|
||
workflow_dispatch: | ||
inputs: | ||
version: | ||
type: string | ||
description: 'The version to publish' | ||
required: true | ||
|
||
permissions: | ||
checks: write | ||
contents: write | ||
|
||
jobs: | ||
|
||
publish_docker: | ||
name: Publish to Docker Hub | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to Docker Hub | ||
id: login | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ github.repository }} | ||
tags: | | ||
type=raw,value=${{ inputs.version }},priority=1000 | ||
type=raw,value=latest,enable=${{ !contains(inputs.version, 'beta') }} | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: 'Publish GitHub Tag and Release' | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
type: string | ||
description: 'The version to publish' | ||
required: true | ||
|
||
permissions: | ||
checks: write | ||
contents: write | ||
|
||
jobs: | ||
|
||
publish_tag: | ||
name: Publish GitHub Tag and Release | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create Tag | ||
id: tag | ||
uses: mathieudutour/github-tag-action@v6.1 | ||
with: | ||
custom_tag: ${{ inputs.version }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create release | ||
id: release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
generateReleaseNotes: true | ||
name: ${{ steps.tag.outputs.new_tag }} | ||
tag: ${{ steps.tag.outputs.new_tag }} |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: 'Publish' | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to publish' | ||
required: false | ||
|
||
permissions: | ||
checks: write | ||
contents: write | ||
|
||
jobs: | ||
|
||
lint: | ||
name: Lint | ||
uses: ./.github/workflows/lint.yml | ||
|
||
build: | ||
name: Build | ||
uses: ./.github/workflows/build.yml | ||
|
||
version: | ||
name: Version | ||
uses: ./.github/workflows/version.yml | ||
with: | ||
version: ${{ inputs.version }} | ||
|
||
publish_github: | ||
name: Publish to GitHub | ||
uses: ./.github/workflows/publish-github.yml | ||
needs: [version] | ||
if: ${{ (needs.version.outputs.next_version != needs.version.outputs.previous_version) && (github.ref == 'refs/heads/main') }} | ||
secrets: inherit | ||
with: | ||
version: ${{ needs.version.outputs.next_version }} | ||
|
||
publish_docker: | ||
name: Publish to Docker Hub | ||
uses: ./.github/workflows/publish-docker.yml | ||
needs: [version] | ||
if: ${{ needs.version.outputs.next_version != needs.version.outputs.previous_version }} | ||
secrets: inherit | ||
with: | ||
version: ${{ needs.version.outputs.next_version }} |
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Version | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
type: string | ||
description: 'Next version (manually set)' | ||
required: false | ||
|
||
outputs: | ||
next_version: | ||
description: 'Next version' | ||
value: ${{ jobs.version.outputs.next_version }} | ||
|
||
previous_version: | ||
description: 'Previous version' | ||
value: ${{ jobs.version.outputs.previous_version }} | ||
|
||
permissions: | ||
checks: write | ||
contents: write | ||
|
||
jobs: | ||
|
||
version: | ||
name: Version | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
next_version: ${{ steps.next_version.outputs.value }} | ||
previous_version: ${{ steps.previous_version.outputs.value }} | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get current version | ||
id: next_version | ||
run: | | ||
if [ -n "${{ inputs.version }}" ]; then | ||
value=${{ inputs.version }} | ||
else | ||
value=$(node -p "require('./package.json').version") | ||
fi | ||
echo "next_version=$value" | ||
echo "value=$value" >> $GITHUB_OUTPUT | ||
- name: Get previous version | ||
id: previous_version | ||
run: | | ||
git fetch --tags origin | ||
value=$(git tag --sort=committerdate | sed 's/^v//' | tail -1) | ||
echo "previous_version=$value" | ||
echo "value=$value" >> $GITHUB_OUTPUT |
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
Oops, something went wrong.