Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
Update fork-sync.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
thilohaas authored Aug 8, 2024
1 parent ce3ade3 commit f166e5e
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions .github/workflows/fork-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,27 @@ jobs:
run: |
git config --global user.name 'CI-Robot'
git config --global user.email '[email protected]'
git config --global pull.rebase true
- name: Fetch forked repository tags
run: git fetch origin --tags

- name: Get latest tag from forked repo
id: get_latest_tag_origin
run: echo "::set-output name=latest_tag::$(git describe --tags $(git rev-list --tags --max-count=1))"

- name: Add original repository as remote
run: git remote add upstream https://github.com/ionic-team/stencil.git

- name: Get latest tag from original repo
id: get_latest_tag
run: echo "::set-output name=latest_tag::$(git describe --tags $(git rev-list --tags --max-count=1))"

- name: Fetch original repository tags
run: git fetch upstream --tags

- name: Check if latest tag is already present in forked repo
id: check_tag
run: |
if git rev-parse refs/tags/${{ steps.get_latest_tag.outputs.latest_tag }} >/dev/null 2>&1; then
echo "Tag ${{ steps.get_latest_tag.outputs.latest_tag }} already exists in forked repo."
echo "::set-output name=tag_exists::true"
else
echo "Tag ${{ steps.get_latest_tag.outputs.latest_tag }} does not exist in forked repo."
echo "::set-output name=tag_exists::false"
fi

- name: Get latest tag from original repo
id: get_latest_tag
run: echo "::set-output name=latest_tag::$(git describe --tags $(git rev-list --tags --max-count=1))"

- name: Checkout and merge latest tag from original repo
if: steps.check_tag.outputs.tag_exists == 'false'
if: steps.get_latest_tag_origin.outputs.latest_tag != steps.get_latest_tag.outputs.latest_tag
env:
GH_TOKEN: ${{ github.token }}
run: |
Expand All @@ -54,7 +51,7 @@ jobs:
git push origin main
- name: Check and update package.json name field if needed
if: steps.check_tag.outputs.tag_exists == 'false'
if: steps.get_latest_tag_origin.outputs.latest_tag != steps.get_latest_tag.outputs.latest_tag
env:
GH_TOKEN: ${{ github.token }}
run: |
Expand All @@ -69,18 +66,19 @@ jobs:
fi
- name: Create new tag in forked repository
if: steps.check_tag.outputs.tag_exists == 'false'
if: steps.get_latest_tag_origin.outputs.latest_tag != steps.get_latest_tag.outputs.latest_tag
env:
GH_TOKEN: ${{ github.token }}
run: |
git tag ${{ steps.get_latest_tag.outputs.latest_tag }}
git push origin --tags
- name: Publish to npm
if: steps.check_tag.outputs.tag_exists == 'false'
if: steps.get_latest_tag_origin.outputs.latest_tag != steps.get_latest_tag.outputs.latest_tag
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm install
npm ci
npm run build
npm version ${{ steps.get_latest_tag.outputs.latest_tag }}
npm publish

0 comments on commit f166e5e

Please sign in to comment.