Last active
December 22, 2023 00:34
-
-
Save YonatanKra/99aa3be8aadad92fc87c9fa39658a718 to your computer and use it in GitHub Desktop.
Reusable workflows
This file contains hidden or 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: 🏗 Lint & Build | |
| on: workflow_call | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/setup-node@v2 | |
| with: | |
| node-version: '16' | |
| cache: 'npm' | |
| - run: npm install | |
| - run: npm run lint | |
| - run: npm run build |
This file contains hidden or 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: '🧬 Pre Release' | |
| on: | |
| push: | |
| branches: main | |
| concurrency: | |
| group: ci-pre-release-${{ github.ref }}-1 | |
| cancel-in-progress: true | |
| jobs: | |
| call-lint-and-build: | |
| uses: vonage/vivid-3/.github/workflows/_lint-and-build.yml@main | |
| call-unit-tests: | |
| needs: call-lint-and-build | |
| uses: vonage/vivid-3/.github/workflows/_unit-tests.yml@main | |
| call-upload-artifact: | |
| needs: call-unit-tests | |
| uses: vonage/vivid-3/.github/workflows/_upload-artifact.yml@main | |
| call-pre-release: | |
| needs: call-upload-artifact | |
| uses: vonage/vivid-3/.github/workflows/_publish-package.yml@main | |
| with: | |
| version: 3.0.0 |
This file contains hidden or 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: '📦 Publish Package' | |
| on: | |
| workflow_call: | |
| input: | |
| version: | |
| type: string | |
| required: true | |
| description: Version to bump to | |
| jobs: | |
| release: | |
| name: Publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Download | |
| uses: actions/download-artifact@v2 | |
| with: | |
| name: public-artifact | |
| - name: Setup Node.js | |
| # Setup .npmrc file to publish to npm | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: 'lts/*' | |
| registry-url: 'https://npm.pkg.github.com' | |
| - name: Install | |
| run: npm ci | |
| - name: Bump | |
| env: | |
| short_head: $(git rev-parse --short HEAD) | |
| run: npm version ${{ inputs.version }} --tag latest --no-git-tag-version --no-push | |
| - name: Publish | |
| run: npm publish --access public --tag next --dry-run | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains hidden or 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: '🧳 Upload Artifact' | |
| on: workflow_call | |
| jobs: | |
| upload: | |
| name: "Upload Build Artifact" | |
| runs-on: ubuntu-latest | |
| # env: | |
| # GITHUB_TOKEN: ${{ github.token }} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/setup-node@v2 | |
| with: | |
| node-version: '16' | |
| - run: npm ci | |
| - run: npm run build | |
| - uses: actions/upload-artifact@v2 | |
| if: always() | |
| with: | |
| name: public-artifact | |
| path: | | |
| package.json | |
| package-lock.json | |
| LICENSE.md | |
| dist | |
| .eleventy.js | |
| 11ty | |
| if-no-files-found: error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment