Skip to content

Merge pull request #226 from leomoon/master #51

Merge pull request #226 from leomoon/master

Merge pull request #226 from leomoon/master #51

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- 'master'
paths:
- '.github/workflows/build.yml'
- 'VERSION'
jobs:
build:
name: Pipeline
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out the source code
uses: actions/checkout@v2
- name: Retrieve current version
run: |
VER=$(cat VERSION)
echo "VERSION=$VER" >> $GITHUB_ENV
echo "V_MAJOR=$(echo $VER | cut -d'.' -f1)" >> $GITHUB_ENV
echo "V_MINOR=$(echo $VER | cut -d'.' -f1,2)" >> $GITHUB_ENV
- name: Add version Tag
uses: rickstaa/action-create-tag@v1
with:
tag: ${{ env.VERSION }}
tag_exists_error: false
force_push_tag: true
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
prerelease: false
draft: false
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: |
zavy86/wikidocs
# ghcr.io/username/app
tags: |
type=raw,value=latest
type=raw,value=${{ env.VERSION }}
type=raw,value=${{ env.V_MAJOR }}
type=raw,value=${{ env.V_MINOR }}
- name: Build and push
uses: docker/build-push-action@v6
with:
file: ./docker/production.dockerfile
platforms: linux/amd64,linux/arm64
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}
push: true