forked from satisfactorymodding/smr-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: abstract workflow
- Loading branch information
Showing
9 changed files
with
1,020 additions
and
862 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Production | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/push-base.yml | ||
with: | ||
env: production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
name: push | ||
name: Base | ||
|
||
on: [ push, pull_request ] | ||
on: | ||
workflow_call: | ||
inputs: | ||
env: | ||
required: true | ||
type: string | ||
|
||
env: | ||
NODE_VERSION: "16" | ||
PNPM_VERSION: "6.32.9" | ||
|
||
jobs: | ||
build: | ||
|
@@ -11,14 +20,13 @@ jobs: | |
matrix: | ||
action: [ "build:node", "build:static" ] | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup nodejs | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: Cache pnpm modules | ||
uses: actions/cache@v2 | ||
|
@@ -31,26 +39,29 @@ jobs: | |
${{ runner.os }}-build-${{ env.cache-name }}-16- | ||
- name: Install dependencies | ||
uses: pnpm/action-setup@v1.2.1 | ||
uses: pnpm/action-setup@v2.2.2 | ||
with: | ||
version: 5.17.2 | ||
version: ${{ env.PNPM_VERSION }} | ||
run_install: true | ||
|
||
- name: Build | ||
run: pnpm graphql-codegen:prod && pnpm ${{ matrix.action }} | ||
run: | | ||
set -o allexport; source .env.${{ inputs.env }}; set +o allexport | ||
pnpm graphql-codegen && pnpm ${{ matrix.action }} | ||
env: | ||
NODE_ENV: ${{ inputs.env }} | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup nodejs | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: Cache pnpm modules | ||
uses: actions/cache@v2 | ||
|
@@ -63,13 +74,17 @@ jobs: | |
${{ runner.os }}-build-${{ env.cache-name }}-16- | ||
- name: Install dependencies | ||
uses: pnpm/action-setup@v1.2.1 | ||
uses: pnpm/action-setup@v2.2.2 | ||
with: | ||
version: 5.17.2 | ||
version: ${{ env.PNPM_VERSION }} | ||
run_install: true | ||
|
||
- name: Lint | ||
run: pnpm graphql-codegen:prod && pnpm check && pnpm lint | ||
run: | | ||
set -o allexport; source .env.${{ inputs.env }}; set +o allexport | ||
pnpm graphql-codegen && pnpm check && pnpm lint | ||
env: | ||
NODE_ENV: ${{ inputs.env }} | ||
|
||
pages: | ||
name: Pages | ||
|
@@ -79,14 +94,13 @@ jobs: | |
- lint | ||
if: ${{ github.event_name != 'pull_request' }} | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup nodejs | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: Cache pnpm modules | ||
uses: actions/cache@v2 | ||
|
@@ -99,18 +113,21 @@ jobs: | |
${{ runner.os }}-build-${{ env.cache-name }}-16- | ||
- name: Install dependencies | ||
uses: pnpm/action-setup@v1.2.1 | ||
uses: pnpm/action-setup@v2.2.2 | ||
with: | ||
version: 5.17.2 | ||
version: ${{ env.PNPM_VERSION }} | ||
run_install: true | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
|
||
- name: Build | ||
run: pnpm graphql-codegen:prod && pnpm build:static | ||
run: | | ||
set -o allexport; source .env.${{ inputs.env }}; set +o allexport | ||
pnpm graphql-codegen && pnpm build:static | ||
env: | ||
SVELTE_BASE_PATH: "/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}/${{ env.GITHUB_REF_SLUG }}" | ||
NODE_ENV: ${{ inputs.env }} | ||
|
||
- name: Deploy to pages | ||
uses: JamesIves/[email protected] | ||
|
@@ -122,15 +139,10 @@ jobs: | |
image: | ||
name: Image | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: [ "staging", "production" ] | ||
needs: | ||
- build | ||
- lint | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
|
@@ -148,7 +160,7 @@ jobs: | |
images: ghcr.io/${{ github.repository }} | ||
flavor: | | ||
latest=false | ||
suffix=-${{ matrix.target }} | ||
suffix=-${{ inputs.env }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
|
@@ -158,4 +170,4 @@ jobs: | |
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
BUILD=build:${{ matrix.target }} | ||
BUILD=build:${{ inputs.env }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Staging | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- main | ||
pull_request: | ||
branches-ignore: | ||
- main | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/push-base.yml | ||
with: | ||
env: staging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,4 @@ schema.graphql | |
svelte.config.js | ||
tailwind.config.cjs | ||
tsconfig.json | ||
.pnpm-store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.