diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md 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" 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 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: 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