Skip to content

Commit

Permalink
CI release
Browse files Browse the repository at this point in the history
  • Loading branch information
pilotak committed Nov 8, 2020
1 parent 51a6e82 commit 519cb2f
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: release

on:
push:
tags:
- "v*"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare
id: prepare
run: |
git fetch --prune --unshallow --tags
VERSION=$(git tag --points-at HEAD)
VERSION=${VERSION//v}
IMAGE_NAME=${GITHUB_REPOSITORY#*/}
IMAGE_NAME="${{ secrets.DOCKERHUB_USER }}/${IMAGE_NAME//docker-}"
IMAGE_TAGS="${IMAGE_NAME}:latest,${IMAGE_NAME}:${VERSION}"
echo "## :bookmark_tabs: Changes" >>"CHANGELOG.md"
git log --pretty=format:"- %s %H%n" $(git describe --abbrev=0 --tags $(git describe --tags --abbrev=0)^)...$(git describe --tags --abbrev=0) >>"CHANGELOG.md"
echo ::set-output name=image_tags::${IMAGE_TAGS}
echo ::set-output name=version::${VERSION}
echo ::set-output name=changelog::${CHANGELOG}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: linux/arm/v6,linux/arm/v7,linux/arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.prepare.outputs.image_tags }}

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.prepare.outputs.version }}
body_path: CHANGELOG.md
draft: false
prerelease: false

0 comments on commit 519cb2f

Please sign in to comment.