Skip to content

Commit

Permalink
ci: adds build and push
Browse files Browse the repository at this point in the history
  • Loading branch information
DavDeDev committed May 1, 2024
1 parent e0db8e8 commit 3a6fc2b
Showing 1 changed file with 52 additions and 18 deletions.
70 changes: 52 additions & 18 deletions .github/workflows/my-workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,52 @@
name: my-workflow
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
my-jobb:
name: my-job
runs-on: self-hosted
steps:
# ...
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1

# run any `bun` or `bunx` command
- run: bun install
- run: bun test
name: my-workflow
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

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


jobs:
# I want two jobs one to run tests and publish result and the other to build and push docker image to github container registry
run-tests:
name: tests
runs-on: self-hosted
steps:
# ...
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1

# run any `bun` or `bunx` command
- run: bun install
- run: bun test

build-and-push-image:
name: build-and-push-image
runs-on: self-hosted
needs: ['run-tests']
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- 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.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/user/app:latest
ghcr.io/user/app:1.0.0

0 comments on commit 3a6fc2b

Please sign in to comment.