This repository has been archived by the owner on Sep 8, 2024. It is now read-only.
Automated build #424
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 * * *" | |
jobs: | |
check: | |
name: Check for update | |
runs-on: ubuntu-latest | |
outputs: | |
update: ${{ steps.check.outcome }} | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
cache: "npm" | |
registry-url: "https://registry.npmjs.org" | |
- name: NPM install | |
run: npm ci | |
- id: check | |
name: Check version | |
continue-on-error: true | |
run: node check-version.js | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
needs: check | |
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || needs.check.outputs.update == 'success' | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
cache: "npm" | |
registry-url: "https://registry.npmjs.org" | |
- name: NPM install | |
run: npm ci | |
- name: Build all | |
run: npm run build | |
- name: Git Commit | |
if: github.ref == 'refs/heads/main' | |
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 | |
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 | |
- name: NPM publish | |
if: github.ref == 'refs/heads/main' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish -w packages/cfntypes |