From 70d92cb0eda65bc83843ce47a192cde0611a0a68 Mon Sep 17 00:00:00 2001 From: Alyssa Dai Date: Thu, 7 Dec 2023 14:33:47 -0500 Subject: [PATCH] [CI] Add workflow for building image on release (#243) * add workflow for building image on release * remove manual trigger and use different variable to access release tag name --- .github/workflows/build_docker_on_release.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/build_docker_on_release.yml diff --git a/.github/workflows/build_docker_on_release.yml b/.github/workflows/build_docker_on_release.yml new file mode 100644 index 0000000..b284bf7 --- /dev/null +++ b/.github/workflows/build_docker_on_release.yml @@ -0,0 +1,30 @@ +name: build Docker image on release + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/api:stable, ${{ secrets.DOCKERHUB_USERNAME }}/api:${{ github.event.release.tag_name }} \ No newline at end of file