-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
147 additions
and
47 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,50 @@ | ||
name: "Build and Deploy to Prod" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Determine latest version | ||
run: echo "APP_VERSION=$(git describe --tags || git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build docker image and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
build-args: APP_VERSION=${{ env.APP_VERSION }} | ||
push: true | ||
tags: ghcr.io/sv443-network/jokeapi:latest | ||
|
||
- name: Delete old packages | ||
uses: actions/delete-package-versions@v4 | ||
with: | ||
package-name: ${{ github.event.repository.name }} | ||
package-type: "container" | ||
min-versions-to-keep: 3 | ||
delete-only-untagged-versions: "true" | ||
|
||
- name: Deploy to prod | ||
run: echo "TODO Trigger prod deployment here" |
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,50 @@ | ||
name: "Build and Deploy to Stage" | ||
|
||
on: | ||
push: | ||
branches: | ||
- v3 | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Determine latest version | ||
run: echo "APP_VERSION=$(git describe --tags || git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build docker image and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
build-args: APP_VERSION=${{ env.APP_VERSION }} | ||
push: true | ||
tags: ghcr.io/sv443-network/jokeapi-stage:latest | ||
|
||
- name: Delete old packages | ||
uses: actions/delete-package-versions@v4 | ||
with: | ||
package-name: ${{ github.event.repository.name }} | ||
package-type: "container" | ||
min-versions-to-keep: 3 | ||
delete-only-untagged-versions: "true" | ||
|
||
- name: Deploy to stage | ||
run: echo "TODO Trigger stage deployment here" |
This file was deleted.
Oops, something went wrong.
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,45 @@ | ||
name: "Lint and Analyze Code" | ||
|
||
on: | ||
push: | ||
branches: [main, v3] | ||
pull_request: | ||
branches: [main, v3] | ||
|
||
jobs: | ||
lint: | ||
name: Lint Code | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Lint | ||
run: npm run lint | ||
|
||
analyze: | ||
name: Analyze Code | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
strategy: | ||
matrix: | ||
language: ["javascript"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
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