From 793a4edfa010581c4208d91eb1b7f1303620adf3 Mon Sep 17 00:00:00 2001 From: Sally Young Date: Fri, 16 Aug 2024 11:06:19 +0100 Subject: [PATCH] Issue #650: Fix Drainpipe Dev release workflow --- .github/workflows/DrainpipeDev.yml | 43 ++++++++++++++++++------------ 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/workflows/DrainpipeDev.yml b/.github/workflows/DrainpipeDev.yml index 494176d7b..bfdca031a 100644 --- a/.github/workflows/DrainpipeDev.yml +++ b/.github/workflows/DrainpipeDev.yml @@ -21,14 +21,18 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Add drainpipe-dev deploy key in order to run git clone - uses: webfactory/ssh-agent@v0.9.0 + - uses: ./drainpipe/scaffold/github/actions/common/set-env + + - uses: ./drainpipe/scaffold/github/actions/common/setup-git + with: + git-name: Drainpipe Bot + git-email: no-reply@example.com + + - uses: ./drainpipe/scaffold/github/actions/common/setup-ssh with: ssh-private-key: ${{ secrets.DRAINPIPE_DEV_DEPLOY_KEY }} - log-public-key: false + ssh-known-hosts: ${{ variables.SSH_KNOWN_HOSTS }} - # Commits made by the https://github.com/apps/lullabot-drainpipe application. - # @see https://github.com/orgs/community/discussions/24664 - name: Create git checkout of drainpipe-dev working-directory: drainpipe-dev run: | @@ -37,22 +41,27 @@ jobs: git remote add origin git@github.com:Lullabot/drainpipe-dev.git git fetch origin git reset --mixed origin/${{ github.ref_name }} || git reset --mixed origin/main - git config user.name "Lullabot-Drainpipe[bot]" - git config user.email "157769597+Lullabot-Drainpipe[bot]@users.noreply.github.com" - - - name: Push branch to drainpipe-dev - working-directory: drainpipe-dev - run: | git add -A - git commit -m "$COMMIT_MESSAGE" --allow-empty - git push origin ${{ github.ref_name }} - env: - # Workaround if the commit message contains quotes. - COMMIT_MESSAGE: ${{ github.event.head_commit.message }} + git commit -m "${{ github.event.commits[0].message }}" --allow-empty - - name: Push tag to drainpipe-dev + - name: Tag release if: ${{ startsWith(github.ref, 'refs/tags/') }} working-directory: drainpipe-dev run: | git tag ${{ github.ref_name }} + + - name: Push to drainpipe-dev + working-directory: drainpipe-dev + run: | git push origin ${{ github.ref_name }} + + - name: Create release + if: ${{ startsWith(github.ref, 'refs/tags/') }} + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.DRAINPIPE_DEV_RELEASE_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/lullabot/drainpipe-dev/releases \ + -d '{"tag_name":"${{ github.ref_name }}","name":"${{ github.ref_name }}","body":"See https://github.com/Lullabot/drainpipe/releases/tag/${{ github.ref_name }}","draft":false,"prerelease":false,"generate_release_notes":false}'