Skip to content

Commit f4aa50d

Browse files
committed
feat: init commit
0 parents  commit f4aa50d

File tree

8 files changed

+183
-0
lines changed

8 files changed

+183
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Conventional Commits
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
name: Conventional Commits
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: webiny/[email protected]

.github/workflows/docker-build.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
dockerhub-username:
7+
description: 'DockerHub username'
8+
required: true
9+
type: string
10+
dockerhub-pat:
11+
description: 'DockerHub personal access token'
12+
required: true
13+
type: string
14+
dockerfile:
15+
description: 'Path to Dockerfile'
16+
required: true
17+
type: string
18+
image-name:
19+
description: 'Docker image name'
20+
required: true
21+
type: string
22+
23+
jobs:
24+
build-and-push:
25+
runs-on: ubuntu-latest
26+
env:
27+
IS_TAG_TRIGGER: ${{ startsWith(github.ref, 'refs/tags/v') }}
28+
steps:
29+
- name: Get branch names
30+
id: branch-names
31+
uses: tj-actions/branch-names@v8
32+
33+
# Verify tag is on main or release branch and npm package version matches tag
34+
- name: Verify tag is on main or release branch
35+
if: env.IS_TAG_TRIGGER == 'true'
36+
run: |
37+
if [[ "${{ steps.branch-names.outputs.base_ref_branch }}" == "main" || "${{ steps.branch-names.outputs.base_ref_branch }}" =~ ^release/ ]]; then
38+
echo "✅ Tag ${{ steps.branch-names.outputs.tag }} is on an allowed branch: ${{ steps.branch-names.outputs.base_ref_branch }}"
39+
else
40+
echo "Current base branch: ${{ steps.branch-names.outputs.base_ref_branch }}"
41+
echo "Tags must be created on main or release/* branches."
42+
exit 1
43+
44+
- name: Verify npm package version matches tag
45+
if: env.IS_TAG_TRIGGER == 'true'
46+
uses: nick-y-ito/gha-npm-version-match@v1
47+
48+
- name: Checkout Repository
49+
uses: actions/checkout@v4
50+
51+
# Determine Docker Image Tags
52+
- name: Determine Docker Image Tags
53+
run: |
54+
IMAGE_NAME="${{ inputs.image-name }}"
55+
# Initialize IMAGE_TAG variable
56+
IMAGE_TAG=""
57+
58+
if [[ "$IS_TAG_TRIGGER" == "true" ]]; then
59+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
60+
IMAGE_TAG="$IMAGE_NAME:$TAG_VERSION"
61+
else
62+
SHORT_COMMIT=$(git rev-parse --short HEAD)
63+
IMAGE_TAG="$IMAGE_NAME:dev-$SHORT_COMMIT"
64+
fi
65+
66+
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
67+
echo "✅ Resolved IMAGE_TAG: $IMAGE_TAG"
68+
69+
- name: Login to Docker Hub
70+
uses: docker/login-action@v3
71+
with:
72+
username: ${{ inputs.dockerhub-username }}
73+
password: ${{ inputs.dockerhub-pat }}
74+
75+
- name: Set up QEMU
76+
uses: docker/setup-qemu-action@v3
77+
78+
- name: Set up Docker Buildx
79+
uses: docker/setup-buildx-action@v3
80+
81+
- name: Build and Push Docker Image
82+
uses: docker/build-push-action@v6
83+
with:
84+
file: ${{ inputs.dockerfile }}
85+
push: true
86+
platforms: linux/amd64,linux/arm64
87+
tags: ${{ env.IMAGE_TAG }}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: release-please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
concurrency:
13+
group: release-please
14+
cancel-in-progress: false
15+
16+
jobs:
17+
setup-release-context:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
packages: ${{ steps.check-files.outputs.packages }}
21+
prev_sha: ${{ steps.check-files.outputs.prev_sha }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 2
26+
- name: Get list of workflows with changes
27+
id: check-files
28+
run: |
29+
# Get list of workflows
30+
workflow_list=($(basename -a -s .yml $(find .github/workflows/ -type f -print | xargs -I{} grep -l "workflow_call:$" {})))
31+
# Get list of workflows to release
32+
workflow_with_changes=$(printf "/%s[./]\n" ${workflow_list[@]} | xargs -I{} sh -c "git diff --name-only ${{ github.sha }} ${{ github.sha }}^ | grep -om1 -e '{}' || true" | tr -d /.)
33+
releases_with_changes=$(printf "^%s[./]\n" ${workflow_list[@]} | xargs -I{} sh -c "git diff --name-only ${{ github.sha }} ${{ github.sha }}^ | grep -om1 -e '{}' || true" | tr -d /.)
34+
# Set list of workflows to release
35+
echo "packages=$(jq -cn --args '$ARGS.positional' -- ${workflow_with_changes[@]} ${releases_with_changes[@]})" >> "$GITHUB_OUTPUT"
36+
echo "prev_sha=$(git rev-parse ${{ github.sha }}^)" >> "$GITHUB_OUTPUT"
37+
shell: bash
38+
39+
release-please:
40+
needs: setup-release-context
41+
if: ${{ needs.setup-release-context.outputs.packages != '[]' }}
42+
runs-on: ubuntu-latest
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
package: ${{ fromJSON(needs.setup-release-context.outputs.packages) }}
47+
steps:
48+
- uses: googleapis/release-please-action@v3
49+
id: release
50+
with:
51+
default-branch: main
52+
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
53+
release-type: simple
54+
path: ${{ matrix.package }}
55+
package-name: ${{ matrix.package }}
56+
version-file: ${{ matrix.package }}/version.txt
57+
changelog-path: ${{ matrix.package }}/CHANGELOG.md
58+
last-release-sha: ${{ needs.setup-release-context.outputs.prev_sha }}
59+
labels: ${{ matrix.package }}
60+
bump-patch-for-minor-pre-major: true
61+
bump-minor-pre-major: true
62+
monorepo-tags: true
63+
release-as: ""

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
.vscode

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# iExec reusable workflow repository
2+
3+
This repository contains a reusable workflow for iExec. It is a monorepo that contains the following components:
4+
5+
## Components
6+
7+
### [Build Docker Image](./workflows/build-docker)
8+
This workflow builds a Docker image from a Dockerfile. It is a reusable workflow that can be used in other workflows.
9+
10+
#### Inputs
11+
12+
- `dockerhub-username`: The username of the Docker Hub account where the image will be pushed.
13+
- `dockerhub-pat`: The password of the Docker Hub account where the image will be pushed.
14+
- `dockerfile`: The path to the Dockerfile that will be used to build the image.
15+
- `image-name`: The name of the image that will be built.

docker-build/CHANGELOG.md

Whitespace-only changes.

docker-build/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Docker build

docker-build/version.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)