Skip to content

Commit

Permalink
Workflow to publish to dockerhub
Browse files Browse the repository at this point in the history
  • Loading branch information
Timshel committed Aug 7, 2024
1 parent 3ae51e7 commit 3fb1a25
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: Timshel
60 changes: 60 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand All @@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 3fb1a25

Please sign in to comment.