-
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.
chore(ci): Switch to github workflows (#15)
- Loading branch information
Showing
15 changed files
with
362 additions
and
94 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,45 @@ | ||
--- | ||
name: Build and push container image | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
workflow_call: | ||
secrets: | ||
DOCKERHUB_USERNAME: | ||
required: true | ||
DOCKERHUB_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
container-image: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/amd64${{ github.event_name != 'pull_request' && ', linux/arm64' || '' }} | ||
tags: "${{ vars.IMAGE_NAME }}:${{ vars.IMAGE_VARIANT }}-gh-build-${{ github.run_id }}" | ||
build-args: | | ||
build_log_label=GH Build #${{ github.run_number }} | ||
build_log_url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
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,42 @@ | ||
--- | ||
name: Tag latest container image | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
workflow_call: | ||
secrets: | ||
DOCKERHUB_USERNAME: | ||
required: true | ||
DOCKERHUB_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
latest-image: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Extract Version (Patch) | ||
run: echo "VERSION_PATCH=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV | ||
|
||
- name: Extract Version (Minor) | ||
run: echo "VERSION_MINOR=${VERSION_PATCH%.*}" >> $GITHUB_ENV | ||
|
||
- name: Extract Version (Major) | ||
run: echo "VERSION_MAJOR=${VERSION_MINOR%.*}" >> $GITHUB_ENV | ||
|
||
- name: Tag docker image | ||
run: >- | ||
docker buildx imagetools create ${{ vars.IMAGE_NAME }}:${{ vars.IMAGE_VARIANT }}-gh-build-${{ github.run_id }} | ||
--tag ${{ vars.IMAGE_NAME }}:${{ vars.IMAGE_VARIANT }}-${{ env.VERSION_PATCH}} | ||
--tag ${{ vars.IMAGE_NAME }}:${{ vars.IMAGE_VARIANT }}-${{ env.VERSION_MINOR}} | ||
--tag ${{ vars.IMAGE_NAME }}:${{ vars.IMAGE_VARIANT }}-${{ env.VERSION_MAJOR}} | ||
--tag ${{ vars.IMAGE_NAME }}:${{ vars.IMAGE_VARIANT }} |
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,28 @@ | ||
--- | ||
name: Tag rolling container image | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
workflow_call: | ||
secrets: | ||
DOCKERHUB_USERNAME: | ||
required: true | ||
DOCKERHUB_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
rolling-image: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Tag docker image | ||
run: docker buildx imagetools create ${{ vars.IMAGE_NAME }}:${{ vars.IMAGE_VARIANT }}-gh-build-${{ github.run_id }} --tag ${{ vars.IMAGE_NAME }}:${{ vars.IMAGE_VARIANT }}-rolling |
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: Create github release | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
workflow_call: | ||
secrets: | ||
DOCKERHUB_USERNAME: | ||
required: true | ||
DOCKERHUB_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
release-notes: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write # to be able to publish a GitHub release | ||
issues: write # to be able to comment on released issues | ||
pull-requests: write # to be able to comment on released pull requests | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
|
||
- name: Create Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npx semantic-release |
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,42 @@ | ||
--- | ||
name: Run integration test on container image | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
workflow_call: | ||
secrets: | ||
PRIVATE_SSH_KEY: | ||
required: true | ||
PRIVATE_DIGITALOCEAN_TOKEN: | ||
required: true | ||
PRIVATE_LEGO_ACCOUNT_KEY: | ||
required: true | ||
|
||
env: | ||
IMAGE_NAME: ${{ vars.IMAGE_NAME }} | ||
IMAGE_VARIANT: ${{ vars.IMAGE_VARIANT }} | ||
IMAGE_BUILD_ID: "${{ vars.IMAGE_VARIANT }}-gh-build-${{ github.run_id }}" | ||
PRIVATE_SSH_KEY: "${{ secrets.PRIVATE_SSH_KEY }}" | ||
PRIVATE_DIGITALOCEAN_TOKEN: "${{ secrets.PRIVATE_DIGITALOCEAN_TOKEN }}" | ||
PRIVATE_LEGO_ACCOUNT_KEY: "${{ secrets.PRIVATE_LEGO_ACCOUNT_KEY }}" | ||
DOCKER_COMPOSE_ARGS: >- | ||
-f integration-test/docker-compose.yml | ||
-f integration-test/docker-compose.github.yml | ||
-f integration-test/docker-compose.test-${{ vars.IMAGE_VARIANT }}.github.yml | ||
jobs: | ||
integration-test: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up integration test | ||
run: docker-compose ${{ env.DOCKER_COMPOSE_ARGS }} build | ||
|
||
- name: Run integration test | ||
run: docker-compose ${{ env.DOCKER_COMPOSE_ARGS }} run sut |
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,16 @@ | ||
--- | ||
name: Integration Tests (Pull Request) | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/container-image.yml | ||
secrets: inherit | ||
|
||
run: | ||
needs: build | ||
uses: ./.github/workflows/integration-test.yml | ||
secrets: inherit |
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,23 @@ | ||
--- | ||
name: Publish Rolling Image (Push develop) | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/container-image.yml | ||
secrets: inherit | ||
|
||
run: | ||
needs: build | ||
uses: ./.github/workflows/integration-test.yml | ||
secrets: inherit | ||
|
||
tag: | ||
needs: run | ||
uses: ./.github/workflows/dockerhub-rolling.yml | ||
secrets: inherit |
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,23 @@ | ||
--- | ||
name: Publish Latest Image (Push latest) | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
push: | ||
branches: | ||
- latest | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/container-image.yml | ||
secrets: inherit | ||
|
||
run: | ||
needs: build | ||
uses: ./.github/workflows/integration-test.yml | ||
secrets: inherit | ||
|
||
release: | ||
needs: run | ||
uses: ./.github/workflows/github-release.yml | ||
secrets: inherit |
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,22 @@ | ||
--- | ||
name: Publish Latest Image (Release Published) | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/container-image.yml | ||
secrets: inherit | ||
|
||
run: | ||
needs: build | ||
uses: ./.github/workflows/integration-test.yml | ||
secrets: inherit | ||
|
||
tag: | ||
needs: run | ||
uses: ./.github/workflows/dockerhub-latest.yml | ||
secrets: inherit |
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,15 @@ | ||
{ | ||
"branches": [ | ||
"latest" | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"draftRelease": true | ||
} | ||
] | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.