Skip to content

Commit

Permalink
chore: Update GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ericof committed Mar 3, 2023
1 parent ff2258c commit c27cf30
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 44 deletions.
30 changes: 10 additions & 20 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
name: Code analysis checks
on: [push]

env:
node-version: 16.x

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Main checkout
uses: actions/checkout@v2

# node setup
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
uses: actions/checkout@v3

# node cache
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: 'yarn.lock'

# node install
- name: Install dependencies
Expand Down
39 changes: 35 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,53 @@ on:
push:
tags:
- '*'

env:
IMAGE_NAME: plone/blocks-conversion-tool

jobs:

docker:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}.{{patch}}
type=pep440,pattern={{major}}.{{minor}}
type=pep440,pattern={{major}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
run: make release-image
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: $${{ steps.meta.outputs.labels }}
31 changes: 11 additions & 20 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
name: Unit tests
on: [push]

env:
node-version: 16.x

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]

steps:
- name: Main checkout
uses: actions/checkout@v2

# node setup
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
uses: actions/checkout@v3

# node cache
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: 'yarn.lock'

# node install
- name: Install dependencies
Expand Down

0 comments on commit c27cf30

Please sign in to comment.