Skip to content

Commit

Permalink
Add GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
schnatterer committed Oct 25, 2023
1 parent eef9c92 commit 2305d8d
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Push image
on:
schedule:
# Rebuild once a week
- cron: '0 0 * * 0'
push:
branches: [ main ]

# Allow running this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout image repo
uses: actions/checkout@v3
- name: Checkout upstream repo
uses: actions/checkout@v3
with:
repository: mailhog/mailhog
token: ${{ secrets.GITHUB_TOKEN }}
path: upstream
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create tags
id: create-tag
run: |
GHCR_IMAGE=ghcr.io/${{ github.repository_owner }}/mailhog
# Find latest tag
VERSION="$(cd upstream && git describe --tags $(git rev-list --tags --max-count=1))"
VERSION_DATE="$VERSION-$(date +'%Y-%m-%d')"
TAGS="${GHCR_IMAGE}:latest,${GHCR_IMAGE}:${VERSION},${GHCR_IMAGE}:${VERSION_DATE}"
echo "TAGS=${TAGS}" | tee -a $GITHUB_ENV
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.TAGS }}
labels: |
org.opencontainers.image.authors=${{ github.repository_owner }}
org.opencontainers.image.created=${{ env.BUILD_DATE }}
org.opencontainers.image.description=Created from commit ${{ env.GIT_SHA }} and ref ${{ env.GIT_REF }}
org.opencontainers.image.ref.name=${{ env.GIT_REF }}
org.opencontainers.image.revision=${{ env.GIT_SHA }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.description=Created from commit ${{ env.GIT_SHA}} and ref ${{ env.GIT_REF }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Cloudogu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

0 comments on commit 2305d8d

Please sign in to comment.