Skip to content

Docker

Docker #2

name: Docker
on:
push:
branches: [ "master" ]
tags: [ "v**" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
strategy:
matrix:
app:
- xelis_daemon
- xelix_miner
- xelis_wallet
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Process app name
run: |
APP=${{ matrix.app }}
echo "XELIS_APP=${APP#xelis_}" >> "$GITHUB_ENV"
- name: Process app version
run: |
VERSION=`awk -F ' = ' '$1 ~ /version/ { gsub(/[\\"]/, "", $2); printf("%s",$2) }' ${{ matrix.app }}/Cargo.toml`
echo "XELIS_VERSION=${VERSION}" >> "$GITHUB_ENV"
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: xelis/${{ env.XELIS_APP }}
labels: |
org.opencontainers.image.title=Xelis ${{ env.XELIS_APP }}
tags: |
type=schedule,pattern=${{ env.XELIS_VERSION }}-nightly-{{date 'YYYYMMDD'}}
type=semver,pattern={{version}},event=tag
type=ref,event=branch
type=ref,event=pr
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' && (github.ref_type == 'tag' || github.ref == 'dev') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args:
- app=${{ matrix.app }}

Check failure on line 72 in .github/workflows/docker-publish.yml

View workflow run for this annotation

GitHub Actions / Docker

Invalid workflow file

The workflow is not valid. .github/workflows/docker-publish.yml (Line: 72, Col: 13): A sequence was not expected

Check failure on line 72 in .github/workflows/docker-publish.yml

View workflow run for this annotation

GitHub Actions / Docker

Invalid workflow file

The workflow is not valid. .github/workflows/docker-publish.yml (Line: 72, Col: 13): A sequence was not expected
- commit-hash=${{ github.sha }}
platforms: linux/amd64,linux/arm64