Skip to content

Commit

Permalink
Merge pull request #21 from initia-labs/feat/action
Browse files Browse the repository at this point in the history
feat: add docker.yml
  • Loading branch information
JSHan94 authored Feb 5, 2024
2 parents c326470 + 53aaaaa commit 0ccf678
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Docker

on:
workflow_dispatch:
push:
branches: [ "main" ]
tags:
- "v*"

env:
REGISTRY: ghcr.io
IMAGE_NAME: opinit

jobs:
opinit:
name: opinit
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

outputs:
tags: ${{ steps.meta.outputs.tags }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}

- name: Build and push
uses: docker/build-push-action@v4
with:
build-args: "GITHUB_ACCESS_TOKEN=${{ secrets.GH_READ_TOKEN }}"
file: bots/Dockerfile
push: ${{ startsWith(github.ref, 'refs/tags') }} # push image only for tags
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 0ccf678

Please sign in to comment.