Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AWS S3 instead of ngrok #161

Merged
merged 18 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
module.exports = {
extends: [
'airbnb-base',
'airbnb-typescript/base',
],
extends: ['airbnb-base', 'airbnb-typescript/base', 'prettier'],
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 'latest',
Expand Down
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '43 14 * * 0'

Expand All @@ -32,39 +32,39 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,62 @@ A opinionated set of GitHub Actions to automatically create/push/preview themes
These actions are built on top of [Theme Kit](https://shopify.dev/themes/tools/theme-kit), and expects a `config.yml` file to exist in your repository.

## Commands

#### Deploy theme(s)

This action will deploy one or more themes using Theme Kit's `deploy` command.

```yaml
...
---
- name: Deploy theme
uses: grafikr/shopify-actions@v1
with:
ACTION: "DEPLOY"
ACTION: 'DEPLOY'
COMMAND: "--env='*-production' --allow-live"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
...
```

[Full example](./examples/deploy.yml)

#### Preview theme

This action will create a theme, and add a comment with preview links.

This command will also download any [ignored file](https://shopify.dev/themes/tools/theme-kit/configuration-reference#ignore-patterns]) from the environment specified in the `THEME_KIT_ENVIRONMENT` input.

```yaml
...
---
- name: Create preview
uses: grafikr/shopify-actions@v1
with:
ACTION: "PREVIEW"
ACTION: 'PREVIEW'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
...
```

[Full example](./examples/preview.yml)

#### Delete theme

This action will delete a theme which has been created for preview. This is usually an action you want to use when closing a pull request.

```yaml
...
---
- name: Create preview
uses: grafikr/shopify-actions@v1
with:
ACTION: "DELETE"
ACTION: 'DELETE'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
...
```

[Full example](./examples/delete.yml)

## Inputs

| Input | Description | Required | Default |
|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|-------------|
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----------- |
| ACTION | The action you want to run. | :white_check_mark: | - |
| THEME_KIT_ENVIRONMENT | The "environment" in your config.yml the action should get it values from.<br/>It will use this to get the token and URL to create/delete a preview theme. | :x: | development |
| THEME_KIT_DEPLOY_COMMAND | The Theme Kit command you want to use to deploy themes.<br/>E.g. '--env="*-production" --allow-live'. | :x: | - |
| THEME_KIT_DEPLOY_COMMAND | The Theme Kit command you want to use to deploy themes.<br/>E.g. '--env="\*-production" --allow-live'. | :x: | - |
| SHOPIFY_THEME_ROLE | The "role" the preview theme will get.<br/>[Read more about roles](https://shopify.dev/api/admin-rest/2021-10/resources/theme#resource-object) | :x: | development |
| GITHUB_TOKEN | The Github token. Used to create comments. | :white_check_mark: | - |
| BUILD_DIR | The directory where the project will be build. Should only be changed if you already use this directory. | :x: | build |
40 changes: 28 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,46 @@
name: "Shopify Theme Kit Actions"
description: "A opinionated set of Github Actions to automatically create/push/preview themes on Shopify stores."
author: "Grafikr"
name: 'Shopify Theme Kit Actions'
description: 'A opinionated set of Github Actions to automatically create/push/preview themes on Shopify stores.'
author: 'Grafikr'

branding:
icon: "shopping-cart"
color: "green"
icon: 'shopping-cart'
color: 'green'

inputs:
ACTION:
description: "Action to use. Must be 'DEPLOY', 'PREVIEW' or 'DELETE'"
required: true

AWS_S3_REGION:
description: 'AWS region'
required: false

AWS_S3_BUCKET:
description: 'AWS bucket'
required: false

AWS_S3_ACCESS_KEY_ID:
description: 'AWS access key id'
required: false

AWS_S3_SECRET_ACCESS_KEY:
description: 'AWS secret access key'
required: false

THEME_KIT_ENVIRONMENT:
description: "The Theme Kit environment to build theme from. Defaults to 'development'"
required: false

THEME_KIT_DEPLOY_COMMAND:
description: "The Theme Kit command you want to use to deploy themes"
description: 'The Theme Kit command you want to use to deploy themes'
required: false

SHOPIFY_THEME_ROLE:
description: "The role which a newly created Shopify theme should have. Defaults to 'development'"
required: false

GITHUB_TOKEN:
description: "Github authentication token"
description: 'Github authentication token'
required: true

BUILD_DIR:
Expand All @@ -33,14 +49,14 @@ inputs:

outputs:
SHOPIFY_THEME_ID:
description: "The created themes ID"
description: 'The created themes ID'

SHOPIFY_THEME_PREVIEW_URL:
description: "The created themes preview URL"
description: 'The created themes preview URL'

SHOPIFY_THEME_CUSTOMIZE_URL:
description: "The created themes customize URL"
description: 'The created themes customize URL'

runs:
using: "node16"
main: "dist/index.js"
using: 'node16'
main: 'dist/index.js'
Binary file added dist/bin/theme
Binary file not shown.
Loading