fix(release): auto-tag and build

This commit is contained in:
Jguer 2020-01-12 17:40:43 +01:00
parent a9b74a0e1e
commit b242d0ac4b
No known key found for this signature in database
GPG key ID: 6D6CC9BEA8556B35
3 changed files with 22 additions and 28 deletions

View file

@ -6,7 +6,6 @@ on:
- 'doc/**'
- 'README.md'
- '.gitignore'
- 'CHANGELOG.md'
pull_request:
jobs:
@ -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

View file

@ -1,8 +1,9 @@
name: Release
on:
push:
tags:
- v**
branches:
- master
jobs:
build-releases:
@ -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
@ -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
@ -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

View file

@ -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