mirror of
https://github.com/meshtastic/web.git
synced 2025-12-24 00:00:01 -05:00
Add github action to release to stable (#590)
* feat: added github action workflow to release to stable * updated trigger logic
This commit is contained in:
50
.github/workflows/update-stable-from-master.yml
vendored
Normal file
50
.github/workflows/update-stable-from-master.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: Update Stable Branch from Master on Latest Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update-stable-branch:
|
||||
name: Update Stable Branch from Master
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name "GitHub Actions Bot"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Fetch latest master and stable branches
|
||||
run: |
|
||||
git fetch origin master:master
|
||||
git fetch origin stable:stable || echo "Stable branch not found remotely, will create."
|
||||
|
||||
- name: Get latest master commit SHA
|
||||
id: get_master_sha
|
||||
run: echo "MASTER_SHA=$(git rev-parse master)" >> $GITHUB_ENV
|
||||
|
||||
- name: Check out stable branch
|
||||
run: |
|
||||
if git show-ref --verify --quiet refs/heads/stable; then
|
||||
git checkout stable
|
||||
git pull origin stable # Sync with remote stable if it exists
|
||||
else
|
||||
echo "Creating local stable branch based on master HEAD."
|
||||
git checkout -b stable ${{ env.MASTER_SHA }}
|
||||
fi
|
||||
|
||||
- name: Reset stable branch to latest master
|
||||
run: git reset --hard ${{ env.MASTER_SHA }}
|
||||
|
||||
- name: Force push stable branch
|
||||
run: git push origin stable --force
|
||||
Reference in New Issue
Block a user