Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update GitHub token in release workflow #481

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
- name: Checkout dev Branch
uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0

- name: Import GPG Key
Expand Down Expand Up @@ -55,45 +56,37 @@ jobs:
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
NEW_VERSION=$(npm version ${{ github.event.inputs.release-type }} --no-git-tag-version)
NEW_VERSION_CLEAN=${NEW_VERSION#v}
echo "current_version=$CURRENT_VERSION" >> $GITHUB_ENV
echo "new_version=$NEW_VERSION" >> $GITHUB_ENV

- name: Create or Checkout Release Branch
run: |
BRANCH="release/v${{ env.new_version }}"
if git show-ref --quiet refs/heads/$BRANCH; then
git checkout $BRANCH
else
git checkout -b $BRANCH
fi
echo "new_version=$NEW_VERSION_CLEAN" >> $GITHUB_ENV

- name: Update Dependencies and Version
run: |
npm install
git add package.json package-lock.json
git commit -m "chore: bump version to ${{ env.new_version }}" || echo "No changes to commit"

- name: Push Changes
- name: Push Changes to dev
run: |
BRANCH="release/v${{ env.new_version }}"
git push origin $BRANCH
git push origin dev

- name: Create Pull Request
- name: Create Pull Request to main
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.PAT }}
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: bump version to ${{ env.new_version }}"
branch: "release/v${{ env.new_version }}"
base: main
branch: dev
title: "Release v${{ env.new_version }}"
body: "Automated release PR for version ${{ env.new_version }}"
delete-branch: false
draft: false
draft: true
labels: 'release, automated'
reviewers: 'EvanNotFound'
assignees: 'EvanNotFound'

- name: Create GitHub Release (Draft)
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: ncipollo/release-action@v1
with:
tag: "v${{ env.new_version }}"
Expand Down
Loading