This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
Publish NPM package #12
Workflow file for this run
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
# Copyright Jiaqi Liu. All rights reserved. | ||
--- | ||
name: Screwdriver API CI/CD | ||
"on": | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
tests: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- run: npm install | ||
- run: npm test | ||
release: | ||
name: Publish NPM Packages | ||
# if: github.ref == 'refs/heads/master' | ||
needs: test | ||
Check failure on line 26 in .github/workflows/ci-cd.yml GitHub Actions / Screwdriver API CI/CDInvalid workflow file
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set node version to 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: "https://registry.npmjs.org" | ||
- name: Publish to NPM Packages | ||
run: | | ||
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | ||
npm publish --access public | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
docker-image: | ||
name: Build Test & Release Docker Image | ||
needs: release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Test image build | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: false | ||
- name: Login to DockerHub | ||
# if: github.ref == 'refs/heads/master' | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Push image to DockerHub | ||
# if: github.ref == 'refs/heads/master' | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/screwdriver:latest | ||
- name: Docker Hub Description | ||
# if: github.ref == 'refs/heads/master' | ||
uses: peter-evans/dockerhub-description@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
repository: ${{ secrets.DOCKERHUB_USERNAME }}/screwdriver |