Skip to content

Commit

Permalink
fix(release): auto-tag and build
Browse files Browse the repository at this point in the history
  • Loading branch information
Jguer committed Jan 12, 2020
1 parent a9b74a0 commit b242d0a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 28 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- 'doc/**'
- 'README.md'
- '.gitignore'
- 'CHANGELOG.md'
pull_request:

jobs:
Expand All @@ -23,14 +22,3 @@ jobs:
with:
name: yay_release
path: artifacts
tag:
if: contains(github.ref, 'master')
name: Tag release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: mathieudutour/github-tag-action@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: 'v'
create_annotated_tag: true
28 changes: 16 additions & 12 deletions .github/workflows/docker-multiarch-tag.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Release
on:
push:
tags:
- v**
branches:
- master


jobs:
build-releases:
Expand All @@ -13,10 +14,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
uses: actions/checkout@v1
- name: Tag version
uses: mathieudutour/github-tag-action@v3
id: tag_version
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: 'v'
- name: Set version
id: set_version
run: ./testdata/ci/version.sh
run: ./testdata/ci/version.sh ${{ steps.tag_version.outputs.previous_tag }} ${{ steps.tag_version.outputs.new_tag }}
- name: Install dependencies
run: sudo apt update -y && sudo apt install -y qemu qemu-user-static
- name: Setup qemu-user-static
Expand All @@ -30,16 +37,11 @@ jobs:
with:
name: yay_${{ matrix.arch }}
path: artifacts
create_release:
name: Create release from this build
needs: [build-releases]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Set version
id: set_version
run: ./testdata/ci/version.sh
run: ./testdata/ci/version.sh ${{ steps.tag_version.outputs.previous_tag }} ${{ steps.tag_version.outputs.new_tag }}
- uses: actions/download-artifact@master
with:
name: yay_x86_64
Expand All @@ -57,8 +59,10 @@ jobs:
with:
tag_name: ${{ steps.set_version.outputs.version }}
release_name: ${{ steps.set_version.outputs.version }}
body: "## Changelog"
draft: true
body: |
## Changelog
${{ steps.set_version.outputs.changelog }}
draft: false
prerelease: false
- name: Upload x86_64 asset
id: upload-release-asset-x86_64
Expand Down
10 changes: 6 additions & 4 deletions testdata/ci/version.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash

if git describe --tags --exact-match ; then
echo "::set-output name=VERSION::$(git describe --tags --exact-match | sed 's/^v//g')"
else
echo "::set-output name=VERSION::$(git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')"
echo "::set-output name=CHANGELOG::$(git log --pretty=format:'%s%n%b==============================================' --abbrev-commit $1..$2)"

if git describe --tags --exact-match; then
echo "::set-output name=VERSION::$(git describe --tags --exact-match | sed 's/^v//g')"
else
echo "::set-output name=VERSION::$(git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')"
fi

0 comments on commit b242d0a

Please sign in to comment.