From c846c290a2be629221153f178763310cd646f211 Mon Sep 17 00:00:00 2001 From: SpikeySanju Date: Thu, 31 Oct 2024 06:53:16 +0530 Subject: [PATCH] ci: replace npm with bun in workflows --- .github/workflows/ci.yml | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7c214ca --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,67 @@ +name: CI/CD + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + outputs: + new-release-published: ${{ steps.release.outputs.new-release-published }} + new-release-version: ${{ steps.release.outputs.new-release-version }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Run semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + id: release + run: bunx semantic-release + + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + needs: release + if: needs.release.outputs.new-release-published == 'true' + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ needs.release.outputs.new-release-version }} + build-args: | + VERSION=${{ needs.release.outputs.new-release-version }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file