Skip to content

Commit

Permalink
CI fixup yarn-install (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
serbantarmure authored Jun 17, 2024
1 parent 347caef commit 20ea651
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-hotels-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'davinci-github-actions': patch
---

- fixup naming for custom runners for @yarn-install
4 changes: 2 additions & 2 deletions build-push-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ runs:
password: ${{ env.GCR_ACCOUNT_KEY }}

- name: Set up Docker Buildx - CI custom runners
if: "contains(runner.name, 'inf-gha-runners-runners') || contains(runner.name, 'ubuntu2204')"
if: "contains(runner.name, 'inf-gha-runners') || contains(runner.name, 'ubuntu2204')"
uses: docker/setup-buildx-action@v3
with:
driver: remote
endpoint: ${{ env.DOCKER_BUILDX_ENDPOINT }}

- name: Set up Docker Buildx - GH runners
if: "!(contains(runner.name, 'inf-gha-runners-runners') && contains(runner.name, 'ubuntu2204'))"
if: "!(contains(runner.name, 'inf-gha-runners') && contains(runner.name, 'ubuntu2204'))"
uses: docker/setup-buildx-action@v3

- name: Build and push release image
Expand Down
12 changes: 6 additions & 6 deletions yarn-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ runs:
shell: bash

- name: Checkout `cache action` from actions repository
if: "inputs.checkout-token && (contains(runner.name, 'inf-gha-runners-ci') || contains(runner.name, 'ubuntu2204'))"
if: "inputs.checkout-token && (contains(runner.name, 'inf-gha-runners') || contains(runner.name, 'ubuntu2204'))"
uses: actions/checkout@v3
with:
repository: toptal/actions
token: ${{ inputs.checkout-token }}
path: ./.github/cache_action/

- name: Cache yarn and node_modules folder
if: "inputs.checkout-token && (contains(runner.name, 'inf-gha-runners-ci') || contains(runner.name, 'ubuntu2204'))"
if: "inputs.checkout-token && (contains(runner.name, 'inf-gha-runners') || contains(runner.name, 'ubuntu2204'))"
uses: ./.github/cache_action/cache/
id: node-modules-cache-custom
with:
Expand All @@ -73,7 +73,7 @@ runs:
key: ${{ runner.os }}-${{ runner.arch }}-node-${{ steps.set-node-version.outputs.version }}-yarn-node_modules-${{ hashFiles('yarn.lock', 'tmp-workspaces.json') }}-${{ inputs.cache-version }}

- name: Cache yarn and node_modules folder
if: "!contains(runner.name, 'inf-gha-runners-ci') || !inputs.checkout-token || !contains(runner.name, 'ubuntu2204')"
if: "!(inputs.checkout-token && (contains(runner.name, 'inf-gha-runners') || contains(runner.name, 'ubuntu2204')))"
uses: actions/cache@v3
id: node-modules-cache
with:
Expand All @@ -93,7 +93,7 @@ runs:
# This step creates .npmrc file that references to npm registry in GAR (Google Artifact Registry)
# The npm registry works as a proxy-cache, downloading and storing the public npm packages
- name: Create .npmrc file using npm Artifact Registry
if: "inputs.checkout-token && inputs.npm-gar-token && (contains(runner.name, 'inf-gha-runners-ci') || contains(runner.name, 'ubuntu2204'))"
if: "inputs.checkout-token && inputs.npm-gar-token && (contains(runner.name, 'inf-gha-runners') || contains(runner.name, 'ubuntu2204'))"
run: |
echo "registry=https://us-central1-npm.pkg.dev/toptal-ci/npm-registry/" > ${{ inputs.path }}/.npmrc &&
echo "//us-central1-npm.pkg.dev/toptal-ci/npm-registry/:username=_json_key_base64" >> ${{ inputs.path }}/.npmrc &&
Expand All @@ -110,7 +110,7 @@ runs:
# This step changes the public npm registry in yarn.lock file to npm in AR
# We still use the public npm registry to our private packages
- name: Change registry in yarn.lock file to npm Artifact Registry
if: "inputs.checkout-token && inputs.npm-gar-token && (contains(runner.name, 'inf-gha-runners-ci') || contains(runner.name, 'ubuntu2204'))"
if: "inputs.checkout-token && inputs.npm-gar-token && (contains(runner.name, 'inf-gha-runners') || contains(runner.name, 'ubuntu2204'))"
shell: bash
run: |
# Create a copy of specific URLs (npmjs.org, @toptal and @topkit) and since they are fewer to restore them back at later steps
Expand Down Expand Up @@ -157,7 +157,7 @@ runs:
# Revert the URLs to the original registry
- name: Revert URLs to original registry
if: "inputs.checkout-token && inputs.npm-gar-token && (contains(runner.name, 'inf-gha-runners-ci') || contains(runner.name, 'ubuntu2204'))"
if: "inputs.checkout-token && inputs.npm-gar-token && (contains(runner.name, 'inf-gha-runners') || contains(runner.name, 'ubuntu2204'))"
shell: bash
run: |
# Revert specific URLs to npmjs.org
Expand Down

0 comments on commit 20ea651

Please sign in to comment.