Skip to content

CI for releases

CI for releases #15

Workflow file for this run

name: CI for releases
on:
schedule:
- cron: '0 0 1 * *' # first day of the month
jobs:
build-and-push-docker-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
IMAGE_NAME: "reversed-ssh-tunnel" # can't contain uppercases
steps:
-
name: Checkout repository
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Get latest tag
id: latest_tag
run: echo ::set-output name=tag::$(git describe --tags $(git rev-list --tags --max-count=1))
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
tags: |
${{ steps.latest_tag.outputs.tag }}
latest
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}