From a5ab255953b728f9264b0d16191095d9bbc836fe Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 6 Apr 2022 16:25:39 +0200 Subject: [PATCH] Add Github workflows --- .github/changelog-configuration.json | 30 ++++++++++++++ .github/workflows/build.yml | 22 +++++++++++ .github/workflows/release.yml | 58 ++++++++++++++++++++++++++++ .gitignore | 1 - 4 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 .github/changelog-configuration.json create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/changelog-configuration.json b/.github/changelog-configuration.json new file mode 100644 index 0000000..e085426 --- /dev/null +++ b/.github/changelog-configuration.json @@ -0,0 +1,30 @@ +{ + "pr_template": "- ${{TITLE}} (#${{NUMBER}})", + "categories": [ + { + "title": "## 🚀 Features", + "labels": ["enhancement"] + }, + { + "title": "## 🛠️ Minor Changes", + "labels": ["change"] + }, + { + "title": "## 🔎 Breaking Changes", + "labels": ["breaking"] + }, + { + "title": "## 🐛 Fixes", + "labels": ["bug"] + }, + { + "title": "## 📄 Documentation", + "labels": ["documentation"] + }, + { + "title": "## 🔗 Dependency Updates", + "labels": ["dependency"] + } + ], + "template": "${{CATEGORIZED_COUNT}} changes since ${{FROM_TAG}}\n\n${{CHANGELOG}}" +} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7bbbc23 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,22 @@ +name: Test + +on: + pull_request: {} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: ghcr.io/${{ github.repository }} + + - name: Build image + uses: docker/build-push-action@v2 + with: + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..46d388f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Release + +on: + push: + tags: + - "*" + +env: + REGISTRY_URL: ghcr.io + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REGISTRY_URL }}/${{ github.repository }} + + - name: Docker login + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY_URL }} + username: ${{ github.repository_owner }} + password: ${{ github.token }} + + - name: Build image + uses: docker/build-push-action@v2 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Build changelog from PRs with labels + id: build_changelog + uses: mikepenz/release-changelog-builder-action@v2 + with: + configuration: ".github/changelog-configuration.json" + # PreReleases still get a changelog, but the next full release gets a diff since the last full release, + # combining possible changelogs of all previous PreReleases in between. + # PreReleases show a partial changelog since last PreRelease. + ignorePreReleases: "${{ !contains(github.ref, '-rc') }}" + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Create Release + uses: ncipollo/release-action@v1 + with: + body: ${{steps.build_changelog.outputs.changelog}} + prerelease: "${{ contains(github.ref, '-rc') }}" + # Ensure target branch for release is "master" + commit: master + token: ${{ github.token }} diff --git a/.gitignore b/.gitignore index 22990c0..e51a112 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ lib-cov *.out *.pid *.gz -.* *.sqlite pids logs