Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Use buildah directly for building because docker-related action doesn…
Browse files Browse the repository at this point in the history
…'t support '--squash' flag
  • Loading branch information
floating-cat committed Feb 13, 2024
1 parent 40c51a2 commit 9fc862b
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
name: Build Docker Image
on:
push:
branches:
- 'main'
paths:
- 'Dockerfile'
- '.github/workflows/build.yml'
schedule:
- cron: '0 0 * * 0'

env:
IMAGE_NAME: ptr-test
IMAGE_TAGS: v1 ${{ github.sha }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}

jobs:
docker:
push-ghcr:
name: Build and push image
runs-on: ubuntu-latest
steps:
-
run: |
- run: |
echo "GitHub Event name: ${{ github.event_name }}"
# We run this every week and skip building when no update from the spark package
if [ "${{ github.event_name }}" != "push" ]; then
Expand All @@ -23,20 +31,18 @@ jobs:
exit 1
fi
fi
-
name: Checkout
- name: Checkout project
uses: actions/checkout@v4
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5

- run: buildah build --squash -t spark-wechat .

- name: Push To GHCR
uses: ./
id: push
with:
context: .
push: true
tags: wechat-spark:${{ github.run_number }}
image: spark-wechat
tags: latest
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}

0 comments on commit 9fc862b

Please sign in to comment.