Merge remote-tracking branch 'upstream/main' #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Delivery - Cef | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- packages/cef/** | |
- package.json | |
- .github/workflows/cd-cef.yml | |
jobs: | |
pre_ci: | |
name: Prepare CI environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: '[Push] Get commit message' | |
if: github.event_name == 'push' | |
id: push_get_commit_message | |
run: echo ::set-output name=push_commit_message::$(git log --format=%B -n 1 HEAD) | |
- name: '[Pull Request] Get commit message' | |
if: github.event_name == 'pull_request' | |
id: pr_get_commit_message | |
run: echo ::set-output name=pr_commit_message::$(git log --format=%B -n 1 HEAD^2) | |
outputs: | |
commit_message: $( [ -z "${{ steps.pr_get_commit_message.outputs.pr_commit_message }}" ] && echo "${{ steps.push_get_commit_message.outputs.push_commit_message }}" || echo "${{ steps.pr_get_commit_message.outputs.pr_commit_message }}" ) | |
PublishCEF: | |
name: Publish CEF | |
runs-on: ubuntu-latest | |
if: "!contains(needs.pre_ci.outputs.commit_message, '[skip ci]')" | |
needs: pre_ci | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js v16 with NPM Registry | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
- name: Publish Types | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
run: | | |
REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
echo -e "\n# Move to the CEF workspace directory" | |
cd packages/cef | |
echo -e "\n# Checkout the repo in the target branch" | |
TARGET_BRANCH="types-cef" | |
git clone $REPO out -b $TARGET_BRANCH | |
echo -e "\n# Move the generated code to the newly-checked-out repo, to be committed and pushed" | |
rsync -vaI package.json out/ | |
rsync -vaI README.md out/ | |
rsync -vaI LICENSE out/ | |
rsync -vaI index.d.ts out/ | |
echo -e "\n# Commit and push" | |
cd out | |
git add --all . | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git commit -m "publish(cef): output for ${GITHUB_SHA}" || true | |
git push origin $TARGET_BRANCH | |
env: | |
GITHUB_TOKEN: ${{ secrets.COMMIT_TOKEN }} |