Skip to content

Commit

Permalink
build: updated workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
tiller1010 committed Mar 27, 2023
1 parent 35ed72b commit 4b5d3cb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
33 changes: 20 additions & 13 deletions .github/workflows/publish_release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types:
- closed
branches:
- master
- main
- support/*

jobs:
Expand All @@ -19,19 +19,26 @@ jobs:
with:
fetch-depth: 0

- name: Get repository name
id: repo-name
uses: tiller1010/get-repo-name-action@master
with:
with-owner: 'true'

- name: Get release id
id: get_release_id
run: |
TOKEN=${{ secrets.GITHUB_TOKEN }}
RELEASEID=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" https://api.github.com/repos/werkbot/silverstripe-module-newsletter/releases)
TOKEN="${{ secrets.GITHUB_TOKEN }}"
REPO="${{ steps.repo-name.outputs.repository-name }}"
RELEASEID=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" https://api.github.com/repos/$REPO/releases)
RELEASEID=$(echo "$RELEASEID" | grep \"id\" | head -n 1 | sed -re "s/[a-z]*//g;s/[-|,|:|'\"]//g;s/\s//g")
echo "release_id=$RELEASEID" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Payload info
id: payload_info
uses: Dovyski/payload-info-action@master
uses: tiller1010/payload-info-action@master
continue-on-error: true


Expand Down Expand Up @@ -61,7 +68,7 @@ jobs:
# Re-Draft Release with hotfix tag
# "release-drafter" works by checking the changes of merged pull requests.
# For support or master branch hotfixes, there is only one merged hotfix PR, which is only now available,
# For support or main branch hotfixes, there is only one merged hotfix PR, which is only now available,
# so we need to re-draft the release with the recently merged PR for release notes.
- name: Draft Release with hotfix tag
id: update_release_draft_with_hotfix_branch
Expand Down Expand Up @@ -94,7 +101,7 @@ jobs:
- name: Generate Changelog
id: changelog
if: steps.is_support_branch.outputs.filtered_branch_name == ''
uses: loopwerk/tag-changelog@v1.0.4
uses: tiller1010/tag-changelog@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
exclude_types: other,doc,chore
Expand All @@ -116,15 +123,15 @@ jobs:

- name: Approve PR
if: steps.is_support_branch.outputs.filtered_branch_name == ''
uses: hmarr/auto-approve-action@v2
uses: hmarr/auto-approve-action@v3
with:
review-message: Auto approved automated PR
pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }}
github-token: ${{ secrets.SOME_USERS_PAT }}

- name: Auto merge
if: steps.is_support_branch.outputs.filtered_branch_name == ''
uses: pascalgn/automerge-action@v0.15.3
uses: pascalgn/automerge-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST: ${{ steps.create_pr.outputs.pull-request-number }}
Expand All @@ -134,7 +141,7 @@ jobs:
if: steps.is_support_branch.outputs.filtered_branch_name == ''
uses: actions/checkout@master
with:
ref: master
ref: main
# END CHANGELOG PORTION


Expand All @@ -148,16 +155,16 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: Merged support into develop

# Merge master changes into develop
- name: Merge master -> develop
# Merge main changes into develop
- name: Merge main -> develop
if: steps.is_support_branch.outputs.filtered_branch_name == ''
uses: devmasx/merge-branch@master
with:
type: now
from_branch: master
from_branch: main
target_branch: develop
github_token: ${{ secrets.GITHUB_TOKEN }}
message: Merged master into develop
message: Merged main into develop

# Remove the release or hotfix branch after publishing
- name: Remove PR branch
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v2
- uses: mheap/github-action-required-labels@v3
with:
mode: exactly
count: 1
Expand Down

0 comments on commit 4b5d3cb

Please sign in to comment.