-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31145b9
commit 71548da
Showing
4 changed files
with
97 additions
and
29 deletions.
There are no files selected for viewing
Empty file.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,107 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | ||
|
||
name: Node.js Package | ||
name: NPM Pipeline | ||
|
||
on: | ||
workflow_call: {} | ||
push: | ||
branches: | ||
- "*" | ||
tags: | ||
- 'v*' | ||
- "v*" | ||
|
||
jobs: | ||
build: | ||
Test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: "npm" | ||
registry-url: https://registry.npmjs.org | ||
cache-dependency-path: package-lock.json | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_INSTALL_TOKEN }} | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run tests | ||
run: npm test | ||
|
||
Build: | ||
runs-on: ubuntu-latest | ||
needs: Test | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- run: npm ci | ||
- run: npm test | ||
node-version-file: '.nvmrc' | ||
cache: "npm" | ||
registry-url: https://registry.npmjs.org | ||
cache-dependency-path: package-lock.json | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_INSTALL_TOKEN }} | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
publish-npm: | ||
needs: build | ||
Publish: | ||
runs-on: ubuntu-latest | ||
needs: Build | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm run build | ||
- run: npm publish | ||
node-version-file: '.nvmrc' | ||
cache: "npm" | ||
registry-url: https://registry.npmjs.org | ||
cache-dependency-path: package-lock.json | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.npm_token}} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Publish package | ||
run: npm publish | ||
|
||
- name: Build package | ||
run: npm run build-packages | ||
|
||
- name: Upload build artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: awsudo/awsudo:${{github.ref_name}} | ||
|
||
Deploy Docker Image: | ||
runs-on: ubuntu-latest | ||
needs: Publish | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
|
||
steps: | ||
- name: Download build artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: awsudo/awsudo:${{github.ref_name}} | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build Docker image | ||
run: scripts/deploy-docker |
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