Skip to content

Commit

Permalink
ci: create a "publish" branch, keeping published commits (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron authored Aug 7, 2024
1 parent 13a3e2e commit 9e05470
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions .github/workflows/tag-dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,53 @@ on:
tags:
- "v*"

concurrency:
group: tag-dist

jobs:
tag-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: build
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install
working-directory: build
run: npm clean-install --ignore-scripts
- name: Build
working-directory: build
run: npm run build
- name: Commit and Tag the static dist dir
- name: Clone for publishing
shell: bash
env:
SOURCE: https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.${INPUT_ORGANIZATION_DOMAIN}"
git add -f client/dist
git commit -m "Checkin dist dir"
git clone "$SOURCE" publish
cd publish
git fetch --tags
git checkout publish/${{ github.ref_name }} 2>/dev/null || git checkout -b publish/${{ github.ref_name }}
git merge ${{ github.ref_name }} -X theirs
- name: Copy dist folder
shell: bash
run: |
rm -Rf publish/client/dist
cp -a build/client/dist publish/client/
- name: Commit and Tag the static dist dir
working-directory: publish
shell: bash
run: |
git add -f client/dist
if [ -n "$(git diff --cached)" ]; then
git commit -m "Checkin dist dir"
else
echo "No changes detected"
fi
git tag static-${{ github.ref_name }} --force
git push --set-upstream origin publish/${{ github.ref_name }}
git push origin static-${{ github.ref_name }} --force

0 comments on commit 9e05470

Please sign in to comment.