From dc8b1596815da65e2ce63e8f2ea36a59c2682c4b Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Mon, 30 Sep 2024 01:58:20 +0000 Subject: [PATCH] feat: add ci --- .github/workflows/build-docker.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/build-docker.yml diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 0000000..ba1f8af --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,30 @@ +name: Build Docker + +on: + push: + branches: [ "main", "feature/docker" ] + # Publish semver tags as releases. + tags: [ '*.*.*' ] + paths-ignore: + - '**.md' + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - id: pre-step + shell: bash + run: echo "image-tag=$(git describe --tags --always)" >> $GITHUB_OUTPUT + - name: Build & Publish Docker Image + uses: elgohr/Publish-Docker-Github-Action@v5 + with: + name: ${{ github.repository }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + tags: "${{ github.ref == 'refs/heads/main' && 'latest,' || '' }}${{ steps.pre-step.outputs.image-tag }}" + no_push: ${{ github.event_name == 'pull_request' }}