Skip to content

chore:update

chore:update #8

Workflow file for this run

name: release
on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
version:
description: 'docker image version, default is git tag'
required: false
default: 'latest'
env:
IMAGE_REPOSITORY: funnyzak/mysql-backup
jobs:
docker-release:
name: Publish Docker images
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set variables
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: Get version from input
if: ${{ github.event.inputs.version != '' }}
run: |
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Build changelog
id: build_changelog
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
uses: mikepenz/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
configuration: '.github/config/changelog_configuration.json'
ignorePreReleases: 'false'
- name: Print variables
run: |
echo "VERSION=${{ env.VERSION }}"
echo "BUILD_DATE=${{ env.BUILD_DATE }}"
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker build and push
uses: docker/build-push-action@v3
with:
context: .
build-args: |
VCS_REF=${{ github.sha }}
BUILD_DATE=${{ env.BUILD_DATE }}
VERSION=${{ env.VERSION }}
push: true
tags: |
${{ env.IMAGE_REPOSITORY }}:${{ env.VERSION }}
${{ env.IMAGE_REPOSITORY }}:latest
platforms: |
linux/amd64
- name: Github release
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
with:
body: ${{steps.build_changelog.outputs.changelog}}
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
push-message:
name: Push message
runs-on: ubuntu-latest
needs: [docker-release]
steps:
- name: Push message
uses: funnyzak/pushoo-action@main
with:
platforms: ifttt,wecombot,bark
tokens: ${{ secrets.PUSH_TOKEN }}
content: |
# ${{ github.event.repository.name }} Docker Build Success
## trigger: ${{ github.event_name }} at ${{ github.event.head_commit.timestamp }}
## commit message: ${{ github.event.head_commit.message }}
## commit url: ${{ github.event.head_commit.url }}
## commit author: ${{ github.event.head_commit.author.name }}
## commit email: ${{ github.event.head_commit.author.email }}
## commit id: ${{ github.event.head_commit.id }}
title: |
${{ github.repository }} ${{ github.event_name }} Message
options: '{"bark": { "url": "https://github.com/${{github.repository}}" }}'
debug: false