Document support of eSCL #1342 #2091
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: Docker Image CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - 'feature/**' | |
| tags: | |
| - 'v*' # Trigger on version tags like v1.0.0 | |
| pull_request: | |
| branches: [ "master" ] | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| jobs: | |
| sonarcloud: | |
| name: SonarCloud | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| actions: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: SonarCloud Scan | |
| uses: SonarSource/sonarcloud-github-action@master | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| actions: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: manuc66/node-hp-scan-to | |
| tags: | | |
| # For version tags like v1.4.3 | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
| # For branches | |
| type=ref,event=branch | |
| flavor: | | |
| latest=false | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20.18.1' | |
| cache: 'yarn' | |
| - name: Install project dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Test | |
| run: yarn test | |
| - name: Build | |
| run: yarn build | |
| - name: cat build | |
| run: cat src/commitInfo.json | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| if: github.event_name != 'pull_request' | |
| with: | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Build Docker image without pushing (PRs only) | |
| if: github.event_name == 'pull_request' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: false | |
| tags: dummy/test:pr-${{ github.sha }} | |
| publish-npm: | |
| name: Publish to npm | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: build-and-push | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| actions: read | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20.18.1' | |
| registry-url: 'https://registry.npmjs.org/' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Test | |
| run: yarn test | |
| - name: Build | |
| run: yarn build | |
| - name: cat build | |
| run: cat src/commitInfo.json | |
| - name: Publish to npm | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |