diff --git a/.github/workflows/release_docker.yml b/.github/workflows/release_docker.yml index bd49546..1b1bc80 100644 --- a/.github/workflows/release_docker.yml +++ b/.github/workflows/release_docker.yml @@ -11,8 +11,8 @@ on: env: DH_REGISTRY_NAME: jqtype/modoh-server - # GHCR: ghcr.io - # GHCR_IMAGE_NAME: ${{ github.repository }} + GHCR: ghcr.io + GHCR_IMAGE_NAME: ${{ github.repository }} jobs: docker_build_and_push: @@ -49,8 +49,8 @@ jobs: tags: | ${{ env.DH_REGISTRY_NAME }}:latest file: ./docker/Dockerfile - cache-from: type=gha,scope=doh-auth-proxy-latest - cache-to: type=gha,mode=max,scope=doh-auth-proxy-latest + cache-from: type=gha,scope=modoh-server-latest + cache-to: type=gha,mode=max,scope=modoh-server-latest labels: ${{ steps.meta.outputs.labels }} - name: Nightly build and push x86_64 @@ -62,6 +62,43 @@ jobs: tags: | ${{ env.DH_REGISTRY_NAME }}:nightly file: ./docker/Dockerfile - cache-from: type=gha,scope=doh-auth-proxy-nightly - cache-to: type=gha,mode=max,scope=doh-auth-proxy-nightly + cache-from: type=gha,scope=modoh-server-nightly + cache-to: type=gha,mode=max,scope=modoh-server-nightly labels: ${{ steps.meta.outputs.labels }} + + dispatch_release: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref == 'develop' && github.event.pull_request.base.ref == 'main' && github.event.pull_request.merged == true }} + needs: docker_build_and_push + steps: + - name: check pull_request title + uses: kaisugi/action-regex-match@v1.0.0 + id: regex-match + with: + text: ${{ github.event.pull_request.title }} + regex: "^(\\d+\\.\\d+\\.\\d+)$" + + - name: checkout + if: ${{ steps.regex-match.outputs.match != '' }} + uses: actions/checkout@v4 + + - name: build release binary + if: ${{ steps.regex-match.outputs.match != '' }} + id: "build" + run: | + cargo build --release --package modoh-server + cp ./target/release/modoh-server /tmp/modoh-server + cd /tmp + tar zcvf modoh-server-x86_64-unknown-linux-gnu.tar.gz modoh-server + + - name: release + if: ${{ steps.regex-match.outputs.match != ''}} + uses: softprops/action-gh-release@v1 + with: + files: /tmp/modoh-server-x86_64-unknown-linux-gnu.tar.gz + name: ${{ github.event.pull_request.title }} + tag_name: ${{ github.event.pull_request.title }} + body: ${{ github.event.pull_request.body }} + draft: true + prerelease: false + generate_release_notes: true