Skip to content

Commit

Permalink
feat: actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyko committed Aug 25, 2023
1 parent cd2cc18 commit adbc0cf
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pages_mogul-menu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions actions/image_tag/README.md
Original file line number Diff line number Diff line change
@@ -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 }}
```
25 changes: 25 additions & 0 deletions actions/image_tag/action.yml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions actions/pages/README.md
Original file line number Diff line number Diff line change
@@ -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
```
6 changes: 3 additions & 3 deletions .github/actions/pages/action.yml → actions/pages/action.yml
Original file line number Diff line number Diff line change
@@ -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`)"
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions actions/yarn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# `yarn`
> Run `yarn install`` with node_modules linker and cache enabled
## Usage
```yaml
-
name: Install dependencies
uses: ./.github/actions/yarn
```
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Truffle <team@truffle.vip>",
"license": "MIT",
"volta": {
"node": "18.10.0"
"node": "18.17.1"
},
"packageManager": "yarn@3.5.0",
"workspaces": [
Expand Down

0 comments on commit adbc0cf

Please sign in to comment.