diff --git a/.github/workflows/pages_mogul-menu.yaml b/.github/workflows/pages_mogul-menu.yaml index a3501848..689beb07 100644 --- a/.github/workflows/pages_mogul-menu.yaml +++ b/.github/workflows/pages_mogul-menu.yaml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@v3 - name: Deploy - uses: ./.github/actions/pages + uses: ./actions/pages with: # The script to build your site (default: `build`) (joins with `yarn workspace $workspace_name`) # build_script: build diff --git a/actions/image_tag/README.md b/actions/image_tag/README.md new file mode 100644 index 00000000..6f1233b5 --- /dev/null +++ b/actions/image_tag/README.md @@ -0,0 +1,20 @@ +# `image_tag` +> Generate a tag for a Docker image + +## Usage +```yaml +- + name: Generate Image Tag + id: generate_tag + uses: ./.github/actions/image_tag + +- + name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.slug }} + tags: | + type=raw,value=latest + type=raw,value=${{ steps.generate_tag.outputs.tag }} +``` diff --git a/actions/image_tag/action.yml b/actions/image_tag/action.yml new file mode 100644 index 00000000..cf79145f --- /dev/null +++ b/actions/image_tag/action.yml @@ -0,0 +1,25 @@ +name: "Generate Image Tag" +description: "Create a Docker Image tag for the current commit" +inputs: + branch: + description: "The branch name" +outputs: + tag: + description: "The generated tag" + value: ${{ steps.default.outputs.tag }} +runs: + using: "composite" + steps: + - name: Generate tag + id: default + shell: bash + run: | + if [ -n "${{ inputs.branch }}" ]; then + branch="${{ inputs.branch }}" + else + branch=${GITHUB_REF#refs/heads/} + fi + sha=${GITHUB_SHA::8} + ts=$(date +%s) + + echo "tag=${branch}-${sha}-${ts}" >> $GITHUB_OUTPUT diff --git a/actions/pages/README.md b/actions/pages/README.md new file mode 100644 index 00000000..bbdbeaf9 --- /dev/null +++ b/actions/pages/README.md @@ -0,0 +1,33 @@ +# pages +> easily deploy sites (with build-scripts) (in a yarn3 monorepo) to Cloudflare Pages + +## Usage +```yaml +steps: + - + name: Checkout repository + uses: actions/checkout@v3 + + - + name: Deploy + uses: ./.github/actions/pages + with: + # The script to build your site (default: `build`) (joins with `yarn workspace $workspace_name`) + # build_script: build + # Cloudflare Account ID + cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + # Cloudflare API Token + cloudflare_api_token: ${{ secrets.CLOUDFLARE_PAGES_API_KEY }} + # The directory of static assets to upload (default: `dist`) + # directory: dist + # GitHub Token + github_token: ${{ secrets.GITHUB_TOKEN }} + # Optional: The script to run before building your site + # prebuild_script: yarn build + # Optional: The branch to deploy to production + # production_branch: main + # The name of the Cloudflare Pages project + project_name: app-truffle-vip + # The name of the yarn workspace being deployed + workspace_name: app.truffle.vip +``` diff --git a/.github/actions/pages/action.yml b/actions/pages/action.yml similarity index 96% rename from .github/actions/pages/action.yml rename to actions/pages/action.yml index 54ec6cf9..4fe0470d 100644 --- a/.github/actions/pages/action.yml +++ b/actions/pages/action.yml @@ -1,5 +1,5 @@ -name: "Truffle " -description: "Publish to Cloudflare Pages" +name: "Publish to Cloudflare Pages" +description: "Publish a Pages project" inputs: build_script: description: "The script to build your site (default: `build`) (joins with `yarn workspace $workspace_name`)" @@ -40,7 +40,7 @@ runs: node-version: 18 - name: Install dependencies - uses: ./.github/actions/yarn + uses: trufflehq/truffle-packages/actions/yarn - name: Get project directory id: get-project-directory diff --git a/actions/yarn/README.md b/actions/yarn/README.md new file mode 100644 index 00000000..b1459f07 --- /dev/null +++ b/actions/yarn/README.md @@ -0,0 +1,9 @@ +# `yarn` +> Run `yarn install`` with node_modules linker and cache enabled + +## Usage +```yaml +- + name: Install dependencies + uses: ./.github/actions/yarn +``` diff --git a/.github/actions/yarn/action.yml b/actions/yarn/action.yml similarity index 100% rename from .github/actions/yarn/action.yml rename to actions/yarn/action.yml diff --git a/package.json b/package.json index 54eb8893..8872cb6f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "author": "Truffle ", "license": "MIT", "volta": { - "node": "18.10.0" + "node": "18.17.1" }, "packageManager": "yarn@3.5.0", "workspaces": [