diff --git a/.github/workflows/publish-branch.yml b/.github/workflows/publish-branch.yml new file mode 100644 index 0000000..48b0f27 --- /dev/null +++ b/.github/workflows/publish-branch.yml @@ -0,0 +1,57 @@ +name: publish-branch + +on: + push: + branches: + - main + +permissions: + contents: read + packages: write + +concurrency: + group: publish-branch-${{ github.ref }} + cancel-in-progress: true + +jobs: + publish: + runs-on: ubuntu-latest + timeout-minutes: 45 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/p-sw/codexdash + tags: | + type=raw,value=main + type=sha,prefix=sha- + + - name: Build and push branch image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha,scope=publish-branch + cache-to: type=gha,mode=max,scope=publish-branch diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..a526f09 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,60 @@ +name: publish-release + +on: + push: + tags: + - 'v*.*.*' + +permissions: + contents: read + packages: write + +concurrency: + group: publish-release-${{ github.ref }} + cancel-in-progress: true + +jobs: + publish: + runs-on: ubuntu-latest + timeout-minutes: 45 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/p-sw/codexdash + tags: | + type=ref,event=tag + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=raw,value=latest + + - name: Build and push release image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha,scope=publish-release + cache-to: type=gha,mode=max,scope=publish-release diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml new file mode 100644 index 0000000..7293acf --- /dev/null +++ b/.github/workflows/verify.yml @@ -0,0 +1,37 @@ +name: verify + +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +jobs: + verify: + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: 1.3.13 + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Run tests + run: bun run test + + - name: Run lint + run: bun run lint + + - name: Run build + run: bun run build + + - name: Verify Docker build + run: docker build --tag codexdash:verify .