provide bot ID as secret #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |