diff --git a/.github/workflows/changelog.yaml b/.github/workflows/changelog.yaml deleted file mode 100644 index f9862bb..0000000 --- a/.github/workflows/changelog.yaml +++ /dev/null @@ -1,40 +0,0 @@ -on: - release: - type: published - -jobs: - comment: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: "3.8" - - name: Update version - id: version - run: | - echo "GITHUB_REF is a tag you set for the release" - echo "Your GitHub ref: ${GITHUB_REF}" - VERSION=`echo "${GITHUB_REF}" | cut -f 3 -d "/"` - echo "Preparing version ${VERSION}" - echo "__version__ = \"${VERSION}\"" > __version__.py - echo "##[set-output name=version;]$(echo ${VERSION})" - - uses: vemel/update-changelog@0.0.1 - id: changelog - with: - version: ${{ steps.version.outputs.version }} - - name: Create Pull Request - uses: peter-evans/create-pull-request@v2 - with: - commit-message: Release ${{ steps.version.outputs.version }} - labels: release, bot - title: "Release ${{ steps.version.outputs.version }}" - body: | - # Release ${{ steps.version.outputs.version }} - - Merge this PR to update your version and changelog! - - ## Included Pull Requests - - ${{ steps.changelog.outputs.pulls_list_md }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2a7671c..3b01d4c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -8,55 +8,29 @@ on: - "*" jobs: - generate-changelog: - name: Generate changelog + release: + if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - - name: Get latest published release tag - id: get_latest_release - uses: pozetroninc/github-action-get-latest-release@v0.5.0 - with: - repository: ${{ github.repository }} - excludes: prerelease, draft - - name: Generate changelog since last published release - uses: charmixer/auto-changelog-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - future_release: ${{ github.ref }} - since_tag: ${{ steps.get_latest_release.outputs.release }} - - name: Upload changelog - uses: actions/upload-artifact@v2 - with: - name: changelog - path: CHANGELOG.md - - draft-release: - name: Draft Github release - needs: generate-changelog - runs-on: ubuntu-20.04 - outputs: - upload_url: ${{ steps.create_release.outputs.upload_url }} - steps: - - name: Extract tag name - id: tag - uses: actions/github-script@v4 - with: - result-encoding: string - script: | - return context.payload.ref.replace(/\/refs\/tags\//, ''); + - name: Build Changelog + id: github_release + uses: mikepenz/release-changelog-builder-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Download changelog - uses: actions/download-artifact@v2 - with: - name: changelog - - name: Draft release with changelog - id: create_release + - name: Create Release uses: actions/create-release@v1 + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: ${{steps.github_release.outputs.changelog}} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create PR + uses: peter-evans/create-pull-request@v3 with: - tag_name: ${{ steps.tag.outputs.result }} - release_name: POS System ${{ steps.tag.outputs.result }} - body_path: CHANGELOG.md - draft: true - prerelease: false + delete-branch: true + title: Updating CHNAGELOG.md + body: ${{steps.github_release.outputs.changelog}} + labels: doc,changelog