This repository has been archived by the owner on Sep 8, 2024. It is now read-only.
rewrite generation and revert to 0.x #452
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: Automated build | |
on: | |
workflow_dispatch: | |
push: | |
schedule: | |
- cron: "0 0 * * 0" | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
outputs: | |
update: ${{ steps.check.outcome }} | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
cache: "npm" | |
registry-url: "https://registry.npmjs.org" | |
- name: NPM install | |
run: npm ci | |
- name: Build all | |
run: npm run build | |
- id: check | |
name: Check for changes | |
run: | | |
! git diff --quiet | |
- name: Upload artifact | |
if: steps.check.outcome == 'success' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cfntypes | |
path: packages/cfntypes/lib | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' && needs.build.outputs.update == 'success' | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: cfntypes | |
path: packages/cfntypes/lib | |
- name: Git Commit | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
run: | | |
set -e | |
git config user.email "[email protected]" | |
git config user.name "Github Actions" | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
(cd packages/cfntypes && npm version patch) | |
cfntypes_package_version=`jq -r '.version' packages/cfntypes/package.json` | |
git add -A | |
git commit -m "v${cfntypes_package_version}" | |
git tag -m "v${cfntypes_package_version}" -a "v${cfntypes_package_version}" | |
git push --follow-tags origin main |