From efb4ef9974de0072dc8c95e7cc74cfcf261cd738 Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 20 Apr 2025 12:11:59 +0100 Subject: [PATCH 1/9] Add name input --- .github/workflows/test.yml | 32 ++++++++++++++++++++++++++++++++ Dockerfile | 9 +++++++++ 2 files changed, 41 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..964f8fe --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: test + +on: push + +jobs: + build: + runs-on: ubuntu-latest + env: + METABLOCK_API_TOKEN: ${{ secrets.METABLOCK_API_TOKEN }} + METABLOCK_BLOCK_ID: 9f15b0a7a60e4f528e573444cc5af7e0 + + steps: + - name: checkout repo + uses: actions/checkout@v4 + - name: build example + uses: actions/setup-node@v4 + with: + node-version: 22.x + - name: build example + run: make build-example + - name: stage deployment + uses: ./ + if: github.ref != 'refs/heads/main' + with: + env: stage + bundle: example/dist + - name: prod deployment + uses: ./ + if: github.ref == 'refs/heads/main' + with: + env: prod + bundle: example/dist diff --git a/Dockerfile b/Dockerfile index 759fd88..0a924a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,14 @@ +<<<<<<< HEAD FROM python:3.13-slim WORKDIR /action RUN pip install metablock +======= +FROM node:22-slim + +WORKDIR /action + +ENV DOCKER=yes NODE_ENV=production +RUN npm i --global @metablock/cli@0.26.8 +>>>>>>> cd224bd (bump) From 060f9a7642b3f461d133f55b450775e419313cff Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 19 Apr 2025 11:36:25 +0100 Subject: [PATCH 2/9] new example --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 964f8fe..b6222a5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest env: METABLOCK_API_TOKEN: ${{ secrets.METABLOCK_API_TOKEN }} - METABLOCK_BLOCK_ID: 9f15b0a7a60e4f528e573444cc5af7e0 + METABLOCK_BLOCK_ID: 85ef26bff9f0454aa6ff0516b6d52420 steps: - name: checkout repo @@ -15,7 +15,7 @@ jobs: - name: build example uses: actions/setup-node@v4 with: - node-version: 22.x + node-version: 22 - name: build example run: make build-example - name: stage deployment From 3551a1253d37b93dc9d3d754f85bc7690989f71c Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 19 Apr 2025 22:41:05 +0100 Subject: [PATCH 3/9] Use python client --- .github/workflows/test.yml | 32 -------------------------------- Dockerfile | 9 --------- 2 files changed, 41 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index b6222a5..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: test - -on: push - -jobs: - build: - runs-on: ubuntu-latest - env: - METABLOCK_API_TOKEN: ${{ secrets.METABLOCK_API_TOKEN }} - METABLOCK_BLOCK_ID: 85ef26bff9f0454aa6ff0516b6d52420 - - steps: - - name: checkout repo - uses: actions/checkout@v4 - - name: build example - uses: actions/setup-node@v4 - with: - node-version: 22 - - name: build example - run: make build-example - - name: stage deployment - uses: ./ - if: github.ref != 'refs/heads/main' - with: - env: stage - bundle: example/dist - - name: prod deployment - uses: ./ - if: github.ref == 'refs/heads/main' - with: - env: prod - bundle: example/dist diff --git a/Dockerfile b/Dockerfile index 0a924a2..759fd88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,5 @@ -<<<<<<< HEAD FROM python:3.13-slim WORKDIR /action RUN pip install metablock -======= -FROM node:22-slim - -WORKDIR /action - -ENV DOCKER=yes NODE_ENV=production -RUN npm i --global @metablock/cli@0.26.8 ->>>>>>> cd224bd (bump) From 53e17d2e9e505cb75e4558df8cf315f74eafc05f Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 19 Apr 2025 22:48:21 +0100 Subject: [PATCH 4/9] Use python client --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 182ec1e..782638c 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,6 @@ runs: - "--token" - ${{ inputs.token }} - "--block-id" - - ${{ inputs.block }} + - ${{ inputs.block || env.METABLOCK_BLOCK_ID }} - "--env" - ${{ inputs.env }} From d0b31fc0b573c90088910585e3b73edabd83ada5 Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 19 Apr 2025 22:50:50 +0100 Subject: [PATCH 5/9] Use python client --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 782638c..182ec1e 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,6 @@ runs: - "--token" - ${{ inputs.token }} - "--block-id" - - ${{ inputs.block || env.METABLOCK_BLOCK_ID }} + - ${{ inputs.block }} - "--env" - ${{ inputs.env }} From 58215afb741ed7fc936b3583b75cf20b4c933a0a Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 19 Apr 2025 22:54:13 +0100 Subject: [PATCH 6/9] test env --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 182ec1e..782638c 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,6 @@ runs: - "--token" - ${{ inputs.token }} - "--block-id" - - ${{ inputs.block }} + - ${{ inputs.block || env.METABLOCK_BLOCK_ID }} - "--env" - ${{ inputs.env }} From 241c8a99bc232fbae8c7039fe117c449e10e4ad7 Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 19 Apr 2025 23:17:08 +0100 Subject: [PATCH 7/9] Build gain From e540aff6a5b804aa6c68c746ecd67c67927ca7d0 Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 19 Apr 2025 23:19:02 +0100 Subject: [PATCH 8/9] Build gain --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 782638c..182ec1e 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,6 @@ runs: - "--token" - ${{ inputs.token }} - "--block-id" - - ${{ inputs.block || env.METABLOCK_BLOCK_ID }} + - ${{ inputs.block }} - "--env" - ${{ inputs.env }} From 0437e9535195759fd371b94b794824f85e7def50 Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 20 Apr 2025 12:10:25 +0100 Subject: [PATCH 9/9] Add name input --- LICENSE | 2 +- action.yml | 4 ++++ readme.md | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/LICENSE b/LICENSE index 98d468f..c0dc2a8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2020 Quantmind +Copyright 2025 Quantmind Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice diff --git a/action.yml b/action.yml index 182ec1e..4fe8933 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,8 @@ inputs: env: description: "Metablock environment - can be set via the METABLOCK_ENV env variable" default: "stage" + name: + description: "Optional deployment name - can be set via the METABLOCK_NAME env variable" runs: using: "docker" image: "Dockerfile" @@ -24,3 +26,5 @@ runs: - ${{ inputs.block }} - "--env" - ${{ inputs.env }} + - "--name" + - ${{ inputs.name }} diff --git a/readme.md b/readme.md index 47361fd..ae043ca 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,6 @@ # Metablock Action [![build](https://github.com/quantmind/metablock-action/workflows/build/badge.svg)](https://github.com/quantmind/metablock-action/actions?query=workflow%3Abuild) -[![test](https://github.com/quantmind/metablock-action/workflows/test/badge.svg)](https://github.com/quantmind/metablock-action/actions?query=workflow%3Atest) Deploy a new version of an html block to metablock cloud. @@ -9,7 +8,8 @@ Deploy a new version of an html block to metablock cloud. - **token**: Metablock API token, you need to create one on the metablock admin. Alternatively set the `METABLOCK_API_TOKEN` environment variable. - **block**: Metablock Block ID. Alternatively set the `METABLOCK_BLOCK_ID` environment variable. -- **bundle**: bundle locatiuon. Alternatively set the `BUNDLE_LOCATION` environment variable, (it defaults to `./dist` if not provided) -- **env**: environment where to deploy, either `stage` or `prod`, (it defaults to `stage` if not provided) +- **bundle**: bundle location. Alternatively set the `BUNDLE_LOCATION` environment variable, (it defaults to `./dist` if not provided) +- **env**: environment where to deploy, either `stage` or `prod`, (it defaults to `stage` if not provided). Can be set via `METABLOCK_ENV` environment variable. +- **name**: optional deployment name -Check the [test.yml](./.github/workflows/test.yml) manifest file for an example where pull requests to master are deployed to `stage` and a merge to `master` to `prod`. +Check the [build.yml](./.github/workflows/build.yml) manifest file for an example where pull requests to master are deployed to `stage` and a merge to `master` to `prod`.