only push on main, but still build on push and pr #6
Workflow file for this run
This file contains hidden or 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: build_packages | ||
on: | ||
push: | ||
pr: | ||
defaults: | ||
run: | ||
shell: bash | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
- name: Install ghrocker | ||
run: | | ||
pip install . | ||
- name: Generate Dockerfile | ||
run: | | ||
generate_ghrocker_dockerfile | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Get current date | ||
id: date | ||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | ||
- | ||
name: Build ghrocker Image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: Dockerfile.ghrocker | ||
load: true | ||
push: ${{ github.ref == 'refs/heads/main' }} | ||
tags: | | ||
ghcr.io/tfoote/ghrocker/ghrocker:latest | ||
ghcr.io/tfoote/ghrocker/ghrocker:${{ steps.date.outputs.date }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |