Variables in GH action

Use variables in GH action to define source image version and
tags for built image. Changing version is only required in the
workflow yaml
This commit is contained in:
Jarno Rankinen 2023-11-07 06:26:04 +02:00
parent 3daeb77037
commit 299e0ad9ed
2 changed files with 9 additions and 36 deletions

View File

@ -1,6 +1,10 @@
# This is a basic workflow to help you get started with Actions # This is a basic workflow to help you get started with Actions
name: Automatic Build name: Daily build
env:
NEXTCLOUD_UPSTREAM_VERSION: 27.1.3
IMAGE_MAJOR_VERSION: 27
# Controls when the workflow will run # Controls when the workflow will run
on: on:
@ -10,20 +14,19 @@ on:
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs: jobs:
build_daily: daily_build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Daily image build - name: Daily build
uses: VaultVulp/gp-docker-action@1.6.0 uses: VaultVulp/gp-docker-action@1.6.0
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: nextcloud image-name: nextcloud
extract-git-tag: false extract-git-tag: false
additional-image-tags: 27 27.1.3 additional-image-tags: ${{ env.IMAGE_MAJOR_VERSION }} ${{ env.NEXTCLOUD_UPSTREAM_VERSION }}
custom-args: --platform=linux/arm64,linux/amd64 custom-args: --platform=linux/arm64,linux/amd64 --build-arg="NEXTCLOUD_UPSTREAM_VERSION=${{ env.NEXTCLOUD_UPSTREAM_VERSION }}"

View File

@ -1,30 +0,0 @@
# This is a basic workflow to help you get started with Actions
name: Variable test
env:
NEXTCLOUD_UPSTREAM_VERSION: 27.1.3
IMAGE_MAJOR_VERSION: 27
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
variable_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Test image build
uses: VaultVulp/gp-docker-action@1.6.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: nextcloud
extract-git-tag: false
additional-image-tags: ${{ env.IMAGE_MAJOR_VERSION }} ${{ env.NEXTCLOUD_UPSTREAM_VERSION }}
custom-args: --platform=linux/arm64,linux/amd64 --build-arg="NEXTCLOUD_UPSTREAM_VERSION=${{ env.NEXTCLOUD_UPSTREAM_VERSION }}"