Skip to content

Commit

Permalink
feat(project): Update ghactions workflows deps
Browse files Browse the repository at this point in the history
Signed-off-by: Helio Chissini de Castro <heliocastro@gmail.com>
  • Loading branch information
heliocastro committed Dec 28, 2023
1 parent e6ccf98 commit 89a75f8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 44 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: webiny/action-conventional-commits@v1.1.0
- uses: webiny/action-conventional-commits@v1.2.0

- name: Verify license headers
run: |
Expand Down Expand Up @@ -85,14 +85,6 @@ jobs:
chmod +x scripts/install-thrift.sh
bash scripts/install-thrift.sh
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Build SW360
run: |
mvn clean install --no-transfer-progress -P deploy -Dhelp-docs=true -Dbase.deploy.dir=. -Dliferay.deploy.dir=${PWD}/deploy -Dbackend.deploy.dir=${PWD}/deploy/webapps -Drest.deploy.dir=${PWD}/deploy/webapps -DRunComponentVisibilityRestrictionTest=false -DRunPrivateProjectAccessTest=false -DRunRestForceUpdateTest=false
Expand Down
69 changes: 36 additions & 33 deletions .github/workflows/docker_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ name: Docker Build

on:
schedule:
- cron: "0 0 * * *" # Midnight
- cron: '0 0 * * *' # Midnight
workflow_dispatch:
push:
tags:
- "sw360-*"
- 'sw360-*'
paths-ignore:
- "**.md"
- '**.md'

env:
REGISTRY: ghcr.io
Expand All @@ -30,52 +30,53 @@ permissions: write-all
jobs:
sw360_version:
name: SW360 Version
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
outputs:
sw360_version: ${{ steps.pom_version.outputs.SW360_VERSION }}

steps:
- name: Checkout main repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v3.13.0
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "adopt"
java-version: '11'
cache: 'maven'
distribution: 'temurin'

- name: Get revision from pom.xml
id: pom_version
run: |
echo "SW360_VERSION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout)" >> "$GITHUB_OUTPUT"
base_image:
name: SW360 Base image
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout main repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract components metadata (tags, labels) for base image
id: meta_base
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ github.repository }}/base
Expand All @@ -86,7 +87,7 @@ jobs:
type=raw,value=latest,enable={{is_default_branch}}
- name: Build image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
target: base
Expand All @@ -104,32 +105,32 @@ jobs:

thrift_image:
name: SW360 Thrift image
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout main repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract components metadata (tags, labels) for thrift image
id: meta_thrift
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ github.repository }}/thrift
Expand All @@ -140,7 +141,7 @@ jobs:
type=raw,value=latest,enable={{is_default_branch}}
- name: Build image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
target: sw360thrift
Expand All @@ -156,32 +157,35 @@ jobs:
binary_image:
name: SW360 Binary
needs: [sw360_version, base_image, thrift_image]
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout main repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
version: latest
install: true

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract components metadata (tags, labels) for sw360
id: meta_sw360
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ github.repository }}/binaries
Expand All @@ -192,7 +196,7 @@ jobs:
type=sha,enable=true,prefix=sha-,format=short
- name: Build image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
target: sw360
Expand All @@ -208,33 +212,32 @@ jobs:
runtime_image:
name: SW360 Runtime image
needs: [sw360_version, base_image, binary_image]
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout main repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
echo "SHORT_SHA=sha-$(echo ${{ github.sha }} | cut -c 1-7)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract components metadata (tags, labels) runtime image
id: meta_runtime
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ github.repository }}
Expand All @@ -246,7 +249,7 @@ jobs:
type=ref,event=tag
- name: Build image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
target: runtime
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ tmp/**/*

# Sometimes we do use vim
.swp

# DS_Store
.DS_Store
2 changes: 0 additions & 2 deletions docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ image_build() {

docker buildx build \
--target "$target" \
--tag "${DOCKER_IMAGE_ROOT}/$name:$version" \
--tag "${DOCKER_IMAGE_ROOT}/$name:latest" \
--tag "ghcr.io/${DOCKER_IMAGE_ROOT}/$name:$version" \
--tag "ghcr.io/${DOCKER_IMAGE_ROOT}/$name:latest" \
"$@" .
Expand Down

0 comments on commit 89a75f8

Please sign in to comment.