mirror of
https://github.com/garronej/ts-ci.git
synced 2025-11-30 21:43:05 +00:00
86 lines
2.8 KiB
YAML
86 lines
2.8 KiB
YAML
on:
|
|
repository_dispatch:
|
|
types: publish
|
|
|
|
jobs:
|
|
update_changelog_and_sync_package_lock_version:
|
|
name: Update CHANGELOG.md and make sure package.json and package-lock.json versions matches.
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Synchronize package.json and package-lock.json version if needed.
|
|
uses: garronej/github_actions_toolkit@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
|
with:
|
|
action_name: sync_package_and_package_lock_version
|
|
owner: ${{github.repository_owner}}
|
|
repo: ${{github.event.client_payload.repo}}
|
|
branch: master
|
|
commit_author_email: ts_ci@github.com
|
|
- name: Update CHANGELOG.md
|
|
if: ${{ !!github.event.client_payload.from_version }}
|
|
uses: garronej/github_actions_toolkit@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
|
with:
|
|
action_name: update_changelog
|
|
owner: ${{github.repository_owner}}
|
|
repo: ${{github.event.client_payload.repo}}
|
|
branch_behind: latest
|
|
branch_ahead: master
|
|
commit_author_email: ts_ci@github.com
|
|
exclude_commit_from_author_names_json: '["ts_ci"]'
|
|
|
|
publish_npm:
|
|
runs-on: ubuntu-latest
|
|
needs: update_changelog_and_sync_package_lock_version
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
- name: Remove branch 'latest'
|
|
continue-on-error: true
|
|
run: git push origin :latest
|
|
- name: Create the new 'latest' branch
|
|
run: |
|
|
git branch latest
|
|
git checkout latest
|
|
git push origin latest
|
|
- uses: actions/setup-node@v1
|
|
- run: npm install
|
|
|
|
- run: npm run enable_short_import_path
|
|
env:
|
|
DRY_RUN: "0"
|
|
- name: (DEBUG) Show how the files have been moved to enable short import
|
|
run: ls -lR
|
|
- name: Publishing on NPM
|
|
run: |
|
|
if [ "$NPM_TOKEN" = "" ]; then
|
|
echo "Can't publish on NPM, You must first create a secret called NPM_TOKEN that contains your NPM auth token. https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets"
|
|
false
|
|
fi
|
|
npm publish
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Commit changes
|
|
run: |
|
|
git config --local user.email "ts_ci@github.com"
|
|
git config --local user.name "ts_ci"
|
|
git add -A
|
|
git commit -am "Automatic structural changes"
|
|
- name: Push changes
|
|
uses: ad-m/github-push-action@v0.5.0
|
|
with:
|
|
github_token: ${{ secrets.PAT }}
|
|
branch: latest
|
|
- name: Create Release
|
|
uses: garronej/create-release@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
|
with:
|
|
tag_name: ${{ github.event.client_payload.to_version }}
|
|
release_name: Release ${{ github.event.client_payload.to_version }}
|
|
branch: latest
|
|
draft: false
|
|
prerelease: false
|