Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Publish NPM package #12

Publish NPM package

Publish NPM package #12

Workflow file for this run

# 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

View workflow run for this annotation

GitHub Actions / Screwdriver API CI/CD

Invalid workflow file

The workflow is not valid. .github/workflows/ci-cd.yml (Line: 26, Col: 16): Job 'release' depends on unknown job 'test'. .github/workflows/ci-cd.yml (Line: 44, Col: 16): Job 'docker-image' depends on job 'release' which creates a cycle in the dependency graph.
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