-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds GH workflows for maintenance releases
The problem for now is that the commit after dependency updates isn't pulled by futher steps. It's on the main branch though. Closes #46 by using buildah & qemu. Closes #61 by also pushing to ghcr.io
- Loading branch information
1 parent
c0cf397
commit 0e568e3
Showing
14 changed files
with
257 additions
and
129 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,10 @@ | ||
--- | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
... |
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,141 @@ | ||
name: Build & publish deck-chores | ||
on: | ||
push: | ||
tags: ["*"] | ||
workflow_call: | ||
inputs: | ||
ref: | ||
required: false | ||
type: string | ||
secrets: | ||
DOCKER_AUTH_TOKEN: | ||
required: true | ||
PYPI_AUTH_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
version: | ||
outputs: | ||
version: ${{ steps.echo-version.outputs.version }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ inputs.ref || github.ref }} | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- uses: abatilo/actions-poetry@v2.1.4 | ||
|
||
- id: echo-version | ||
run: echo "::set-ouput name=version::$(poetry version --short)" | ||
|
||
- if: ${{ github.event_name == 'push' }} | ||
run: "[ ${{ steps.echo-version.outputs.version }} == ${{ github.ref }} ]" | ||
|
||
|
||
cheeseshop: | ||
name: Build & publish to the cheeseshop | ||
needs: [version] | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ inputs.ref || github.ref }} | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- uses: abatilo/actions-poetry@v2.1.4 | ||
|
||
- run: poetry build | ||
- run: poetry publish --username __token__ --password ${{ secrets.PYPI_AUTH_TOKEN }} | ||
|
||
container-image: | ||
name: Build & push multi-architecture image | ||
needs: [version] | ||
env: | ||
IMAGE_NAME: deck-chores | ||
DOCKER_IO_USER: funkyfuture | ||
VERSION: ${{ needs.version.outputs.version }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: redhat-actions/podman-login@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
- uses: redhat-actions/podman-login@v1 | ||
with: | ||
registry: docker.io | ||
username: ${{ env.DOCKER_IO_USER }} | ||
password: ${{ secrets.DOCKER_AUTH_TOKEN }} | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ inputs.ref || github.ref }} | ||
|
||
- run: > | ||
echo "PRERELEASE=${{ ( | ||
contains('a', env.VERSION) || contains('b', env.VERSION) | ||
|| contains('rc', env.VERSION) || contains('pre', env.VERSION) | ||
) }}" >> $GITHUB_ENV | ||
- name: echo version related variables | ||
run: | | ||
echo 'VERSION: ${{ env.VERSION }}' | ||
echo 'PRERELEASE: ${{ env.PRERELEASE }}' | ||
- id: docker-metadata | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ env.IMAGE_NAME }} | ||
flavor: latest=false | ||
labels: | | ||
org.opencontainers.image.documentation=https://deck-chores.readthedocs.org/ | ||
org.opencontainers.image.url=https://deck-chores.readthedocs.org/ | ||
tags: | | ||
type=sha,prefix=src-commit- | ||
type=pep440,pattern={{version}},value=${{ env.VERSION }} | ||
type=pep440,pattern={{major}},value=${{ env.VERSION }},enable=${{ env.PRERELEASE == 'false' }} | ||
type=pep440,pattern={{major}}.{{minor}},value=${{ env.VERSION }},enable=${{ env.PRERELEASE == 'false' }} | ||
- name: prepare push tag value | ||
id: push-tags-value | ||
run: echo "::set-output name=tags::${{ steps.docker-metadata.outputs.tags }}" | tr "\n" " " | sed "s/${{ env.IMAGE_NAME }}://g" | ||
|
||
- name: install dependency for multi-platform builds | ||
run: | | ||
sudo apt update | ||
sudo apt install -y qemu-user-static | ||
- id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
containerfiles: | | ||
./Dockerfile | ||
image: ${{ env.IMAGE_NAME }} | ||
labels: ${{ steps.docker-metadata.outputs.labels }} | ||
platforms: linux/amd64,linux/arm,linux/arm64 | ||
tags: ${{ steps.docker-metadata.outputs.tags }} | ||
|
||
- name: echo build outputs | ||
run: | | ||
echo "Image: ${{ steps.build-image.outputs.image }}" | ||
echo "Tags: ${{ steps.build-image.outputs.tags }}" | ||
echo "Tagged Image: ${{ steps.build-image.outputs.image-with-tag }}" | ||
- name: echo created images | ||
run: buildah images | grep '${{ env.IMAGE_NAME }}' | ||
- name: echo image metadata | ||
run: buildah inspect ${{ steps.build-image.outputs.image-with-tag }} | ||
|
||
- name: push to ghcr.io | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
registry: ghcr.io/${{ github.actor }} | ||
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.push-tags-value.outputs.tags }} | ||
|
||
- name: push to docker.io | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
registry: docker.io/${{ env.DOCKER_IO_USER }} | ||
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.push-tags-value.outputs.tags }} |
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,65 @@ | ||
name: Update dependencies & create a maintence release | ||
on: | ||
schedule: | ||
- cron: "35 10 12 * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- uses: abatilo/actions-poetry@v2.1.4 | ||
|
||
- run: poetry update --lock | ||
|
||
- id: commit-and-push | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Updates dependencies | ||
|
||
- if: ${{ steps.commit-and-push.outputs.changes_detected == false }} | ||
run: gh run cancel ${{ github.run_id }} && tail -f /dev/null | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
run-tests: | ||
needs: [update] | ||
uses: funkyfuture/deck-chores/.github/workflows/quality-checks.yml@main | ||
with: | ||
ref: main | ||
|
||
bump-version: | ||
needs: [run-tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: main | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- uses: abatilo/actions-poetry@v2.1.4 | ||
|
||
- id: bump | ||
run: | | ||
poetry version patch | ||
echo "set-output:: name=version::$(poetry version --short)" | ||
- uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: > | ||
Bumps version to ${{ steps.bump.outputs.version }} (maintenance release) | ||
tagging_message: ${{ steps.bump.outputs.version }} | ||
|
||
build-and-publish: | ||
needs: [bump-version] | ||
uses: funkyfuture/deck-chores/.github/workflows/build-and-publish.yml@main | ||
with: | ||
ref: main | ||
secrets: | ||
DOCKER_AUTH_TOKEN: ${{ secrets.DOCKER_AUTH_TOKEN }} | ||
PYPI_AUTH_TOKEN: ${{ secrets.PYPI_AUTH_TOKEN }} |
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
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
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
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
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.