Skip to content

Commit

Permalink
Update and rename docker-image.yml to build-push.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
spectrapulse authored Sep 23, 2023
1 parent 0671627 commit c2ea1c6
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 33 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and push to repository

on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: ["main"]

permissions:
contents: read
packages: write

jobs:
build-and-push:
name: Build Docker image and push to registry
runs-on: ubuntu-latest
steps:
# Get the repository's code
- name: Checkout
uses: actions/checkout@v2
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/kankerdev/spoticord/api
# Docker tags based on the following events/attributes
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: ghcr.io/kankerdev/spoticord/bot:cache
cache-to: ghcr.io/kankerdev/spoticord/bot:cache
33 changes: 0 additions & 33 deletions .github/workflows/docker-image.yml

This file was deleted.

0 comments on commit c2ea1c6

Please sign in to comment.