diff --git a/.github/workflows/draft.yml b/.github/workflows/draft.yml new file mode 100644 index 0000000..7e313d1 --- /dev/null +++ b/.github/workflows/draft.yml @@ -0,0 +1,22 @@ +name: Draft Release + +on: + pull_request: + types: [closed] + branches: + - main + +jobs: + update: + if: github.event.pull_request.merged == true && !contains(github.head_ref, 'release/') + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Update Draft Release + uses: release-drafter/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish-app.yml b/.github/workflows/publish-app.yml new file mode 100644 index 0000000..7ce5a7d --- /dev/null +++ b/.github/workflows/publish-app.yml @@ -0,0 +1,72 @@ +name: Publish App to GHCR + +on: + push: + branches: [main] + tags: + - "v*" + paths: + - ".github/workflows/publish-app.yml" + - ".python-version" + - "Dockerfile" + + workflow_dispatch: + +env: + IMAGE_NAME: ${{ github.repository }}/app + REGISTRY: ghcr.io + +jobs: + publish: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout Repository + uses: actions/checkout@v6 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=sha,prefix={{branch}}- + type=raw,value=latest,enable={{is_default_branch}} + labels: | + maintainer=a5chin + org.opencontainers.image.url=https://github.com/${{ github.repository }} + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.vendor=a5chin + org.opencontainers.image.title=python-uv + org.opencontainers.image.description=App for Python development with uv-based dependency management and environment configuration. + org.opencontainers.image.documentation=https://a5chin.github.io/python-uv/ + org.opencontainers.image.authors=a5chin + org.opencontainers.image.licenses=MIT + + - name: Build and Push App Image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + push: true + provenance: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/publish-devcontainer.yml b/.github/workflows/publish-devcontainer.yml index a6957e4..c088e73 100644 --- a/.github/workflows/publish-devcontainer.yml +++ b/.github/workflows/publish-devcontainer.yml @@ -3,6 +3,8 @@ name: Publish Devcontainer to GHCR on: push: branches: [main] + tags: + - "v*" paths: - ".devcontainer/Dockerfile" - ".github/workflows/publish-devcontainer.yml" @@ -15,7 +17,7 @@ env: REGISTRY: ghcr.io jobs: - publish-devcontainer: + publish: runs-on: ubuntu-latest permissions: @@ -23,20 +25,20 @@ jobs: packages: write steps: - - name: Checkout repository + - name: Checkout Repository uses: actions/checkout@v6 - - name: Set up Docker Buildx + - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to Container Registry + - name: Login to Container Registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata + - name: Extract Metadata id: meta uses: docker/metadata-action@v5 with: @@ -48,8 +50,8 @@ jobs: type=raw,value=latest,enable={{is_default_branch}} labels: | maintainer=a5chin - org.opencontainers.image.url=https://github.com/a5chin/python-uv - org.opencontainers.image.source=https://github.com/a5chin/python-uv + org.opencontainers.image.url=https://github.com/${{ github.repository }} + org.opencontainers.image.source=https://github.com/${{ github.repository }} org.opencontainers.image.vendor=a5chin org.opencontainers.image.title=python-uv org.opencontainers.image.description=Dev Container for Python development with uv-based dependency management and environment configuration. @@ -57,7 +59,7 @@ jobs: org.opencontainers.image.authors=a5chin org.opencontainers.image.licenses=MIT - - name: Build and push devcontainer image + - name: Build and Push Devcontainer Image uses: docker/build-push-action@v6 with: context: . diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release.yml similarity index 79% rename from .github/workflows/release-drafter.yml rename to .github/workflows/release.yml index 097942f..561d037 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Create Release 🚀 +name: Release on: pull_request: @@ -7,8 +7,7 @@ on: - main jobs: - create-release: - name: Create Release + publish: if: github.event.pull_request.merged == true && contains(github.head_ref, 'release/') runs-on: ubuntu-latest @@ -21,11 +20,12 @@ jobs: - name: Checkout uses: actions/checkout@v6 - - uses: release-drafter/release-drafter@v6 + - name: Publish Release + uses: release-drafter/release-drafter@v6 with: config-name: release-drafter.yml disable-autolabeler: true - name: Release ${{ env.VERSION }} + name: ${{ env.VERSION }} publish: true tag: ${{ env.VERSION }} version: ${{ env.VERSION }}