From 3fb1a25bef1e7781d386d8a1be553418f67c91c0 Mon Sep 17 00:00:00 2001 From: Timshel Date: Wed, 7 Aug 2024 17:17:02 +0200 Subject: [PATCH] Workflow to publish to dockerhub --- .github/FUNDING.yml | 1 + .github/workflows/docker.yml | 60 ++++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 3 +- package.json | 2 +- 4 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/docker.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..8712034d --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: Timshel diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..75275818 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,60 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# GitHub recommends pinning actions to a commit SHA. +# To get a newer version, you will need to update the SHA. +# You can also reference a tag or branch, but the action may change without warning. + +name: Publish Docker image + +on: + push: + branches: + - main + tags: + - '*' + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + environment: main + permissions: + packages: write + contents: read + attestations: write + id-token: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 #v5.5.1 + with: + images: timshel/maildev + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@4f7cdeb0f05278b464e71357394bf2c61f94138e #v6.6.0 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 321709af..7c3d3d33 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: # Node LTS https://nodejs.org/en/about/releases/ - node-version: [12.22.11, 14.19.1, 16.x, 18.x] + node-version: [18.x, 20.X, 22.X] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{matrix.node-version}} @@ -19,4 +19,3 @@ jobs: node-version: ${{matrix.node-version}} - run: npm ci - run: npm test - - run: bash <(curl -s https://codecov.io/bash) # Upload to Codecov diff --git a/package.json b/package.json index f06a09bb..5afa632f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "maildev", "description": "SMTP Server and Web Interface for reading and testing emails during development", - "version": "3.0.0-rc1", + "version": "3.0.0-rc0", "keywords": [ "email", "e-mail",