From b242d0ac4b8fa3d137e1106b2664da472e1db09d Mon Sep 17 00:00:00 2001 From: Jguer Date: Sun, 12 Jan 2020 17:40:43 +0100 Subject: [PATCH] fix(release): auto-tag and build --- .github/workflows/docker-ci.yml | 12 ---------- .github/workflows/docker-multiarch-tag.yml | 28 ++++++++++++---------- testdata/ci/version.sh | 10 ++++---- 3 files changed, 22 insertions(+), 28 deletions(-) diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml index c4bc7284..9ff57580 100644 --- a/.github/workflows/docker-ci.yml +++ b/.github/workflows/docker-ci.yml @@ -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 diff --git a/.github/workflows/docker-multiarch-tag.yml b/.github/workflows/docker-multiarch-tag.yml index 3839f7c7..e1e5332e 100644 --- a/.github/workflows/docker-multiarch-tag.yml +++ b/.github/workflows/docker-multiarch-tag.yml @@ -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 diff --git a/testdata/ci/version.sh b/testdata/ci/version.sh index ae464b3e..0cbd5145 100755 --- a/testdata/ci/version.sh +++ b/testdata/ci/version.sh @@ -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