Skip to content

Commit ef9ba13

Browse files
authored
Update workflows (#137)
* update: image-deployment workflow to make Docker image tags optional * feat: enhance image generation workflow to support prerelease builds with optional boolean input
1 parent d225500 commit ef9ba13

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

.github/workflows/image-deployment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ on:
1414
- files_gateway_mainnet_production
1515
gateway_image_tag:
1616
description: 'Docker image tag visit in the releases page at (https://github.com/autonomys/subspace/pkgs/container/gateway)'
17-
required: true
17+
required: false
1818
type: string
1919
indexer_image_tag:
2020
description: 'Docker image tag visit in the releases page at (https://github.com/autonomys/auto-files-gateway/pkgs/container/object-mapping-indexer)'
21-
required: true
21+
required: false
2222
type: string
2323
file_retriever_image_tag:
2424
description: 'Docker image tag visit in the releases page at (https://github.com/autonomys/auto-files-gateway/pkgs/container/file-retriever)'
25-
required: true
25+
required: false
2626
type: string
2727
env:
2828
INFISICAL_CLIENT_ID: ${{ secrets.INFISICAL_CLIENT_ID }}

.github/workflows/image-generations.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
branches:
66
- main
77
workflow_dispatch:
8+
inputs:
9+
prerelease:
10+
description: "Generate prerelease build with branch name and snapshot tags"
11+
required: false
12+
default: false
13+
type: boolean
814

915
env:
1016
TAG_NAME: latest
@@ -33,10 +39,14 @@ jobs:
3339
password: ${{ github.token }}
3440

3541
- name: Add SHORT_SHA env property with commit short sha
36-
run: echo "SHORT_SHA=${GITHUB_SHA::8}" >> $GITHUB_ENV
42+
run: echo "SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-8)" >> $GITHUB_ENV
3743

38-
- name: Build and push Docker image
44+
- name: Add BRANCH_NAME env property with branch name
45+
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
46+
47+
- name: Build and push Docker image (release)
3948
uses: docker/build-push-action@v5
49+
if: ${{ !inputs.prerelease }}
4050
with:
4151
context: .
4252
file: ./services/${{ matrix.app }}/Dockerfile
@@ -47,3 +57,17 @@ jobs:
4757
cache-from: type=gha
4858
cache-to: type=gha,mode=max
4959
platforms: linux/amd64
60+
61+
- name: Build and push Docker image (prerelease)
62+
uses: docker/build-push-action@v5
63+
if: ${{ inputs.prerelease }}
64+
with:
65+
context: .
66+
file: ./services/${{ matrix.app }}/Dockerfile
67+
push: true
68+
tags: |
69+
ghcr.io/${{ github.repository_owner }}/${{ matrix.app }}:${{ env.BRANCH_NAME }}
70+
ghcr.io/${{ github.repository_owner }}/${{ matrix.app }}:snapshot-${{ env.SHORT_SHA }}
71+
cache-from: type=gha
72+
cache-to: type=gha,mode=max
73+
platforms: linux/amd64

0 commit comments

Comments
 (0)