Skip to content

Commit

Permalink
add job for build and pushing images
Browse files Browse the repository at this point in the history
  • Loading branch information
epiccoolguy committed Jan 29, 2024
1 parent 0374efb commit 3f322a6
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:

env:
GO_VERSION: ^1.21.5
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build_and_test:
Expand All @@ -28,3 +30,46 @@ jobs:

- name: Test
run: go test -v ./...

package:
name: Build and push image
runs-on: ubuntu-latest
needs: [build, test]
permissions:
contents: read
packages: write
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Pack
uses: buildpacks/github-actions/setup-pack@v5

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for images
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha
type=sha,format=long
- name: Build and tag images
run: |
pack build ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} \
--tag ${{ steps.meta.outputs.tags }} \
--builder gcr.io/buildpacks/builder:v1 \
--env GOOGLE_FUNCTION_SIGNATURE_TYPE=http \
--env GOOGLE_FUNCTION_TARGET=ModProxy
--publish

0 comments on commit 3f322a6

Please sign in to comment.