testing other way to use env var #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build and Push | ||
on: | ||
push: | ||
branches: | ||
- main | ||
env: | ||
IMAGE_NAME: ghcr.io/zabbix-community/zabbix-server-create-upgrade-db | ||
jobs: | ||
set-timestamp: | ||
name: Set Global Timestamp | ||
runs-on: ubuntu-latest | ||
outputs: | ||
build_timestamp: ${{ steps.set-timestamp.outputs.build_timestamp }} | ||
steps: | ||
- name: Calculate Build Timestamp | ||
id: set-timestamp | ||
run: | | ||
echo "BUILD_TIMESTAMP=$(date -u +%Y%m%d%H%M%S)" >> $GITHUB_ENV | ||
- name: Test build timestamp env var | ||
run: | | ||
echo $BUILD_TIMESTAMP | ||
build-and-push: | ||
name: Build and Push Multi-Arch Images | ||
needs: set-timestamp | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
major_version: ["6.0", "6.4", "7.0", "7.2"] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Test build timestamp env var again | ||
run: | | ||
echo $BUILD_TIMESTAMP | ||
- name: Build and Push Multi-Arch Docker Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
build-args: | | ||
MAJOR_VERSION=${{ matrix.major_version }} | ||
push: true | ||
tags: | | ||
Check failure on line 60 in .github/workflows/docker.build.yml GitHub Actions / Docker Build and PushInvalid workflow file
|
||
${{ env.IMAGE_NAME }}:${{ matrix.major_version }}-${{ BUILD_TIMESTAMP }} |