Skip to content

provide bot ID as secret #48

provide bot ID as secret

provide bot ID as secret #48

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches: [ main ]
env:
GH_IMAGE_NAME: ghcr.io/${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Log into registry ghcr.io
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- name: Inject bot token
run: |
sed -i 's/BOT_TOKEN/${{ secrets.BOT_TOKEN }}/g' configs/local.yaml
sed -i 's/BOT_ID/${{ secrets.BOT_ID }}/g' configs/local.yaml
- name: Generate image tag
run: echo "TAG=$(git rev-parse --abbrev-ref HEAD)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build Docker image
run: docker build -t ${{ env.GH_IMAGE_NAME }}:latest -t ${{ env.GH_IMAGE_NAME }}:${{ env.TAG }} .
- name: Push image to ghcr.io
run: |
docker push ${{ env.GH_IMAGE_NAME }}:latest
docker push ${{ env.GH_IMAGE_NAME }}:${{ env.TAG }}