Skip to content

Commit

Permalink
Install auth token (#143)
Browse files Browse the repository at this point in the history
* Tester å legge auth token for package installs som env var

* Test auth token som env var

* Test auth token som env var

* Sett til master branch
  • Loading branch information
AndreasDybdahl authored Jun 14, 2024
1 parent b5d917d commit b62310d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/actions/build-push-docker-bake/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ inputs:
github-token:
description: "Token to use when signing into ghcr.io for cacheing purposes"
required: true
auth-token:
description: "Token to use when installing packages from npm"
required: true
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -73,14 +76,11 @@ runs:
# with:
# image_ref: ${{ steps.login.outputs.registry }}/${{ github.repository }}/${{ inputs.bake-target }}@${{ steps.build_push.outputs.digest }}

- name: Authenticate with private NPM package
shell: bash
run: echo "//npm.pkg.github.com/:_authToken=${{ inputs.github-token }}" > .npmrc

- name: Build and push with bake
uses: docker/bake-action@7a5dfed3550ca014665af2a27af8fc9d7284b9b3 # ratchet:docker/[email protected]
env:
CACHE_TAG: ${{ steps.generate-cache-tags.outputs.cache-tag }}
PACKAGES_AUTH_TOKEN: ${{ inputs.auth-token }}
with:
no-cache: ${{ github.actor == 'dependabot[bot]' }}
targets: ${{ inputs.bake-target }}
Expand All @@ -90,3 +90,4 @@ runs:
${{ steps.meta.outputs.bake-file }}
set: |
*.platform=${{ inputs.bake-platform }}
*.secrets=id=PACKAGES_AUTH_TOKEN
1 change: 1 addition & 0 deletions .github/workflows/build-docker-bake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
with:
build-version: ${{ steps.generate-build-version.outputs.build-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
auth-token: ${{ secrets.READER_TOKEN }}
push-image: ${{ inputs.push-image }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
Expand Down

0 comments on commit b62310d

Please sign in to comment.