diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index 63136a26..00000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Deploy Images to GHCR - -on: - workflow_run: - workflows: [ "CI fmt clippy and test" ] - types: - - completed - push: - branches: - - main # Trigger only on push to main branch - tags: # Trigger on new tags - - 'v*' - -jobs: - push-store-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: 'Checkout GitHub Action' - uses: actions/checkout@main - - - name: 'Set up Docker Buildx' - uses: docker/setup-buildx-action@v1 - - - name: 'Login to GitHub Container Registry' - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: 'Extract short hash' - id: vars - run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV # This sets the SHORT_SHA environment variable - - - name: 'Set Docker tag' - id: docker_tag - run: | - if [[ "${{ github.ref }}" == refs/tags/* ]]; then - TAG_NAME=${{ github.ref }} - TAG_NAME=${TAG_NAME##*/} - echo "DOCKER_TAG=${TAG_NAME}" >> $GITHUB_ENV - else - echo "DOCKER_TAG=${{ env.SHORT_SHA }}" >> $GITHUB_ENV - fi - - - name: Build and push pbs - uses: docker/build-push-action@v6 - with: - context: . - push: true - tags: ghcr.io/commit-boost/commit-boost-client/pbs:${{ env.DOCKER_TAG }} - cache-from: type=gha - cache-to: type=gha,mode=max - file: docker/pbs.Dockerfile - - - name: Build and push signer - uses: docker/build-push-action@v6 - with: - context: . - push: true - tags: ghcr.io/commit-boost/commit-boost-client/signer:${{ env.DOCKER_TAG }} - cache-from: type=gha - cache-to: type=gha,mode=max - file: docker/signer.Dockerfile \ No newline at end of file diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml new file mode 100644 index 00000000..b3f820e8 --- /dev/null +++ b/.github/workflows/draft-release.yml @@ -0,0 +1,80 @@ +name: Draft Release + +on: + push: + tags: + - "v*" + +env: + BINARY_NAME: commit-boost + +permissions: + contents: write + packages: write + +jobs: + create-draft-release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push PBS Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: | + ghcr.io/commit-boost/pbs:${{ github.ref_name }} + ghcr.io/commit-boost/pbs:latest + cache-from: type=gha + cache-to: type=gha,mode=max + file: docker/pbs.Dockerfile + + - name: Build and push Signer Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: | + ghcr.io/commit-boost/signer:${{ github.ref_name }} + ghcr.io/commit-boost/signer:latest + cache-from: type=gha + cache-to: type=gha,mode=max + file: docker/pbs.Dockerfile + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Build Linux binary + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --target x86_64-unknown-linux-gnu --bin ${{ env.BINARY_NAME }} + + - name: Rename binary + run: | + mv target/x86_64-unknown-linux-gnu/release/${{ env.BINARY_NAME }} ${{ env.BINARY_NAME }}-${{ github.ref_name }}-linux-amd64 + + - name: Create Draft Release + uses: softprops/action-gh-release@v2 + with: + name: Release ${{ github.ref_name }} + tag_name: ${{ github.ref_name }} + draft: true + prerelease: false + files: ${{ env.BINARY_NAME }}-${{ github.ref_name }}-linux-amd64