Skip to content

Create base image release #22

Create base image release

Create base image release #22

Workflow file for this run

name: Create base image release
on:
workflow_dispatch:
inputs:
releaseversion:
description: 'Release version'
required: false
type: string
default: 'X.Y.Z'
schedule:
# Run weekly on wednesday
- cron: '30 1 * * 3'
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
attestations: write
id-token: write
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
ref: ${{ github.head_ref }}
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Install jq
uses: dcarbone/[email protected]
- name: Configure Git author
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
- name: Update Base
run: |
. .github/.bin/version.sh "config_base.json" "${{ inputs.releaseversion }}"
BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
/bin/cat <<EOM >>$GITHUB_ENV
VERSION=$version
APP_VERSION=$version
BUILD_DATE=$BUILD_DATE
EOM
- name: Push To Docker Hub
id: push-to-dockerhub-preview
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.base
push: true
tags: |
cloudtooling/dev-buildbox-base:latest
cloudtooling/dev-buildbox-base:${{env.APP_VERSION}}
build-args: |
BUILD_DATE=${{env.BUILD_DATE}}
APP_VERSION=${{env.APP_VERSION}}
platforms: linux/amd64,linux/arm64
- name: Push changes
run: |
echo "{\"version\":\"${{env.APP_VERSION}}\"}" | jq > config_base.json
git add .
git commit -m "Update Base Image to ${{env.APP_VERSION}}"
git push origin $CI_DEFAULT_BRANCH
git push --tags