From e89bf754db821a225429ace2b7f498bb77955d0c Mon Sep 17 00:00:00 2001 From: Dzmitry Hramyka Date: Fri, 17 Jan 2025 16:10:01 +0100 Subject: [PATCH 1/5] Update docker workflow --- .github/workflows/docker.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 11f34da..30d7d03 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -27,13 +27,12 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - # Don't log in for now - # - name: Log in to Docker Hub - # uses: docker/login-action@v3 - # if: github.event_name == 'push' # Only log in on pushes to main - # with: - # username: ${{ secrets.DOCKER_USERNAME }} - # password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to Docker Hub + uses: docker/login-action@v3 + if: github.event_name == 'push' # Only log in on pushes to main + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push uses: docker/build-push-action@v2 From 28ac06923994be7c5dd843a12456cff54edaad37 Mon Sep 17 00:00:00 2001 From: Dzmitry Hramyka Date: Fri, 17 Jan 2025 16:10:18 +0100 Subject: [PATCH 2/5] Add release-please workflow --- .github/workflows/release-please.yml | 64 ++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/release-please.yml diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..fa25a38 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,64 @@ +name: Release + +on: + push: + branches: + - main + +env: + REGISTRY: docker.io + IMAGE_NAME: ${{ secrets.DOCKER_USERNAME }}/nevron + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + release_name: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} + steps: + - name: Create GitHub release + id: release + uses: GoogleCloudPlatform/release-please-action@v4 + with: + token: ${{ secrets.BOT_TOKEN }} + + Container-Release: + needs: release-please + runs-on: ubuntu-latest + if: ${{ needs.release-please.outputs.release_created }} + 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: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}},value=${{ needs.release-please.outputs.release_name }} + type=semver,pattern={{major}}.{{minor}},value=${{ needs.release-please.outputs.release_name }} + type=semver,pattern={{major}},value=${{ needs.release-please.outputs.release_name }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + push: true \ No newline at end of file From 0630452fe6ed6cf31097b20d750c828823b60318 Mon Sep 17 00:00:00 2001 From: Dzmitry Hramyka Date: Fri, 17 Jan 2025 16:18:39 +0100 Subject: [PATCH 3/5] Add cancel-previous job in the main ci --- .github/workflows/main.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b9ec99d..36d24fa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,6 +11,16 @@ on: - dev jobs: + Cancel-Previous: + runs-on: ubuntu-latest + if: github.ref != 'refs/heads/main' + steps: + - uses: khan/pull-request-workflow-cancel@1.0.1 + with: + workflows: "python.yml" + env: + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + Lint: runs-on: ubuntu-latest steps: From 3e481cb749839e940a0d599d3a721c6c69f37baf Mon Sep 17 00:00:00 2001 From: Dzmitry Hramyka Date: Fri, 17 Jan 2025 16:23:55 +0100 Subject: [PATCH 4/5] Move contributing guideline --- CONTRIBUTING.md => .github/CONTRIBUTING.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CONTRIBUTING.md => .github/CONTRIBUTING.md (100%) diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md From 20d764239dded297213f3fab644cc79c0c4ee04f Mon Sep 17 00:00:00 2001 From: Dzmitry Hramyka Date: Fri, 17 Jan 2025 16:24:41 +0100 Subject: [PATCH 5/5] Add dependabot --- .github/dependabot.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/dependabot.yaml diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..488c846 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,14 @@ +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly"