From 6aea1fd85e74da74889dda8b5d8f25d953355e90 Mon Sep 17 00:00:00 2001 From: shreve Date: Thu, 18 Apr 2024 17:19:32 +0000 Subject: [PATCH] feat(ci): yay working ci --- .devcontainer/toolbox-dev/Dockerfile | 3 + .devcontainer/toolbox-dev/devcontainer.json | 4 +- .devcontainer/toolbox-prod/devcontainer.json | 2 +- .github/workflows/ci.yml | 7 ++- .github/workflows/release.yml | 63 -------------------- 5 files changed, 10 insertions(+), 69 deletions(-) create mode 100644 .devcontainer/toolbox-dev/Dockerfile delete mode 100644 .github/workflows/release.yml diff --git a/.devcontainer/toolbox-dev/Dockerfile b/.devcontainer/toolbox-dev/Dockerfile new file mode 100644 index 0000000..1abb259 --- /dev/null +++ b/.devcontainer/toolbox-dev/Dockerfile @@ -0,0 +1,3 @@ +FROM ghcr.io/ecshreve/toolbox:latest as toolbox + +CMD [ "/bin/bash" ] \ No newline at end of file diff --git a/.devcontainer/toolbox-dev/devcontainer.json b/.devcontainer/toolbox-dev/devcontainer.json index 2c43cf6..b92bdd2 100644 --- a/.devcontainer/toolbox-dev/devcontainer.json +++ b/.devcontainer/toolbox-dev/devcontainer.json @@ -3,8 +3,8 @@ { "name": "toolbox-dev", "build": { - "dockerfile": "../../Dockerfile", - "context": "../..", + "dockerfile": "Dockerfile", + "context": ".", "cacheFrom": "ghcr.io/ecshreve/toolbox-dev:latest" }, "features": { diff --git a/.devcontainer/toolbox-prod/devcontainer.json b/.devcontainer/toolbox-prod/devcontainer.json index 59b0a53..4bc74ea 100644 --- a/.devcontainer/toolbox-prod/devcontainer.json +++ b/.devcontainer/toolbox-prod/devcontainer.json @@ -2,7 +2,7 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile { "name": "toolbox-prod", - "image": "ghcr.io/ecshreve/toolbox-dev:v0.0.42" + "image": "ghcr.io/ecshreve/toolbox-dev:latest" // Features to add to the dev container. More info: https://containers.dev/features. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e47f25..a7544db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,8 @@ jobs: imageName: ghcr.io/ecshreve/toolbox-dev cacheFrom: ghcr.io/ecshreve/toolbox-dev configFile: .devcontainer/toolbox-dev/devcontainer.json - push: always + push: filter + eventFilterForPush: push release: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') @@ -67,7 +68,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - + - name: Create GitHub Release uses: softprops/action-gh-release@v1 with: @@ -82,4 +83,4 @@ jobs: body: | ## info - ![toolbox](https://img.shields.io/badge/toolbox-${{ github.ref_name }}-purple) + [![toolbox](https://img.shields.io/badge/toolbox-${{ github.ref_name }}-purple)](https://github.com/ecshreve/toolbox/pkgs/container/toolbox) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index e532d52..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: release - -on: - workflow_dispatch: - inputs: - tag: - description: 'Tag to release' - required: true - -jobs: - gh-release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - - name: Get Package info - id: info - env: - GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} - OWNER: ${{ github.repository_owner }} - run: | - #!/bin/bash - AUTH_HEADER="Authorization: Bearer $GHCR_TOKEN" - CONTENT_HEADER="Accept: application/vnd.github.v3+json" - - # Base URL for GHCR API - PACKAGES_URL="https://api.github.com/user/packages/container" - - TOOLBOX_URL=$(curl -s -H "$AUTH_HEADER" -H "$CONTENT_HEADER" "$PACKAGES_URL/toolbox/versions" | jq -r '.[] | select(.metadata.container.tags | contains(["latest"])) | .html_url') - # TOOLBOXDEV_URL=$(curl -s -H "$AUTH_HEADER" -H "$CONTENT_HEADER" "$PACKAGES_URL/toolbox-dev/versions" | jq -r '.[] | select(.metadata.container.tags | contains(["latest"])) | .html_url') - - TOOLBOX_IMAGE_SIZE=$(docker manifest inspect -v ghcr.io/ecshreve/toolbox:latest | jq -c 'if type == "array" then .[] else . end' | jq -r '( [ .SchemaV2Manifest.layers[].size ] | add )' | numfmt --to si) - TOOLBOXDEV_IMAGE_SIZE=$(docker manifest inspect -v ghcr.io/ecshreve/toolbox-dev:latest | jq -c 'if type == "array" then .[] else . end' | jq -r '( [ .SchemaV2Manifest.layers[].size ] | add )' | numfmt --to si) - - echo "## info" > RELEASE.txt - echo "[![toolbox](https://img.shields.io/badge/toolbox-${{ inputs.tag }}-purple)]($TOOLBOX_URL?tag=${{ inputs.tag }})" >> RELEASE.txt - echo "[![toolbox-size](https://img.shields.io/badge/toolbox_size-${TOOLBOX_IMAGE_SIZE}-blue)]($TOOLBOX_URL?tag=${{ inputs.tag }})" >> RELEASE.txt - echo "![toolbox-size](https://img.shields.io/badge/toolbox_dev_size-${TOOLBOXDEV_IMAGE_SIZE}-blue)" >> RELEASE.txt - echo "---" >> RELEASE.txt - - - name: Create GitHub Release - uses: softprops/action-gh-release@v1 - with: - token: ${{ secrets.GH_CUSTOM_PAT }} - tag_name: ${{ inputs.tag }} - generate_release_notes: true - draft: false - prerelease: false - files: | - Dockerfile - .devcontainer/toolbox-dev/devcontainer.json - body_path: RELEASE.txt - - \ No newline at end of file