Skip to content

Commit

Permalink
chore(ci): review and enhance
Browse files Browse the repository at this point in the history
  • Loading branch information
alimd committed Nov 27, 2023
1 parent 1882f53 commit e48d5df
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ jobs:
id: yarn_config
run: echo "cache_folder=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/[email protected]
- name: 🏗 Cache Layer
uses: actions/[email protected]
# id: yarn_cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn_config.outputs.cache_folder }}
path: |
${{ steps.yarn_config.outputs.cache_folder }}
/tmp/.buildx-cache
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-yarn
- name: 🏗 Install dependencies
run: yarn install --immutable
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/publish-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ jobs:
fail-fast: false
matrix:
include:
- path: api
- path: nginx
- name: storage-api
path: ./packages/api
context: .
- name: storage-nginx
path: ./packages/nginx
context: ./packages/nginx

permissions:
contents: read
Expand All @@ -48,7 +52,7 @@ jobs:
with:
filters: |
container_folder:
./packages/${{ matrix.path }}/*
${{ matrix.context }}/**
- name: 🏗 Install cosign
if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder != 'false' }}
Expand All @@ -60,10 +64,10 @@ jobs:

- name: 🏗 Cache Docker Layers
if: ${{ steps.file_change.outputs.container_folder != 'false' }}
uses: actions/cache@v3
uses: actions/cache@v3.3.2
with:
path: /tmp/.buildx-cache
key: container/${{ matrix.path }}
key: container/${{ matrix.name }}

- name: 🏗 Log into docker hub registry
if: ${{ github.event_name != 'pull_request' && steps.file_change.outputs.container_folder != 'false' }}
Expand All @@ -87,15 +91,15 @@ jobs:
with:
github-token: ${{secrets.GITHUB_TOKEN}}
images: |
name=ghcr.io/${{env.USER}}/storage-${{matrix.path}},enable=true
name=docker.io/${{env.USER}}/storage-${{matrix.path}},enable=true
name=ghcr.io/${{env.USER}}/${{matrix.name}},enable=true
name=docker.io/${{env.USER}}/${{matrix.name}},enable=true
tags: |
type=semver,enable=true,pattern={{major}}
type=semver,enable=true,pattern={{major}}.{{minor}}
type=semver,enable=true,pattern={{version}}
type=ref,enable=true,event=branch
labels: |
org.opencontainers.image.title="alwatr/storage-${{matrix.path}}"
org.opencontainers.image.title="alwatr/${{matrix.name}}"
org.opencontainers.image.vendor="Alwatr"
org.opencontainers.image.documentation="https://github.com/Alwatr/storage"
org.opencontainers.image.authors="S. Ali Mihandoost <[email protected]> (https://ali.mihandoost.com)"
Expand All @@ -105,7 +109,8 @@ jobs:
id: build_and_push
uses: docker/[email protected]
with:
context: ./packages/${{matrix.path}}
context: ${{matrix.context}}
file: ${{matrix.path}}/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
id: yarn_config
run: echo "cache_folder=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/[email protected]
- name: 🏗 Cache Layer
uses: actions/[email protected]
# id: yarn_cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn_config.outputs.cache_folder }}
Expand Down

0 comments on commit e48d5df

Please sign in to comment.