generated from daystram/go-gin-gorm-boilerplate
-
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.
Merge pull request #49 from daystram/dev
- Loading branch information
Showing
6 changed files
with
51 additions
and
32 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 |
---|---|---|
|
@@ -6,10 +6,13 @@ on: | |
jobs: | ||
image: | ||
name: Publish Image | ||
environment: Development | ||
runs-on: Ubuntu-20.04 | ||
env: | ||
APPLICATION: ratify | ||
strategy: | ||
matrix: | ||
app: [be, fe] | ||
service: [be, fe] | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
@@ -24,18 +27,23 @@ jobs: | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
- name: Set Development Version | ||
run: echo "RELEASE_VERSION=dev" >> $GITHUB_ENV | ||
- name: Provide Env File | ||
run: echo "${{ secrets.FE_ENV_FILE }}" > ${{ env.APPLICATION }}-${{ matrix.service }}/.env.production | ||
- name: Build and Push Image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: folio-${{ matrix.app }} | ||
context: ${{ env.APPLICATION }}-${{ matrix.service }} | ||
platforms: linux/amd64 | ||
tags: daystram/folio:${{ matrix.app }}-${{ env.RELEASE_VERSION }} | ||
tags: daystram/${{ env.APPLICATION }}:${{ matrix.service }}-${{ env.RELEASE_VERSION }} | ||
push: true | ||
chart: | ||
name: Publish Helm Chart | ||
environment: Development | ||
runs-on: Ubuntu-20.04 | ||
container: daystram/k8s-tools:latest | ||
needs: [image] | ||
env: | ||
APPLICATION: ratify | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
@@ -60,8 +68,8 @@ jobs: | |
git clone ssh://[email protected]/daystram/helm-charts.git | ||
cp -r .daystram helm-charts/docs/ | ||
cd helm-charts/docs/ | ||
curl -sfL https://charts.daystram.com/build.sh | sh -s - folio ${{ env.RELEASE_VERSION }} | ||
curl -sfL https://charts.daystram.com/build.sh | sh -s - ${{ env.APPLICATION }} ${{ env.RELEASE_VERSION }} | ||
rm -rf .daystram/ | ||
git add . | ||
git commit -m "feat: added chart for folio@${{ env.RELEASE_VERSION }}" | ||
git commit -m "feat: added chart for ${{ env.APPLICATION }}@${{ env.RELEASE_VERSION }}" | ||
git push |
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 |
---|---|---|
|
@@ -8,7 +8,10 @@ on: | |
jobs: | ||
image: | ||
name: Publish Image | ||
environment: Production | ||
runs-on: Ubuntu-20.04 | ||
env: | ||
APPLICATION: ratify | ||
strategy: | ||
matrix: | ||
app: [be, fe] | ||
|
@@ -26,20 +29,25 @@ jobs: | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
- name: Get Release Version | ||
run: echo "RELEASE_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV | ||
- name: Provide Env File | ||
run: echo "${{ secrets.FE_ENV_FILE }}" > ${{ env.APPLICATION }}-${{ matrix.service }}/.env.production | ||
- name: Build and Push Image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: folio-${{ matrix.app }} | ||
context: ${{ env.APPLICATION }}-${{ matrix.service }} | ||
platforms: linux/amd64 | ||
tags: | | ||
daystram/folio:${{ matrix.app }} | ||
daystram/folio:${{ matrix.app }}-${{ env.RELEASE_VERSION }} | ||
daystram/${{ env.APPLICATION }}:${{ matrix.service }} | ||
daystram/${{ env.APPLICATION }}:${{ matrix.service }}-${{ env.RELEASE_VERSION }} | ||
push: true | ||
chart: | ||
name: Publish Helm Chart | ||
environment: Production | ||
runs-on: Ubuntu-20.04 | ||
container: daystram/k8s-tools:latest | ||
needs: [image] | ||
env: | ||
APPLICATION: ratify | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
@@ -64,8 +72,8 @@ jobs: | |
git clone ssh://[email protected]/daystram/helm-charts.git | ||
cp -r .daystram helm-charts/docs/ | ||
cd helm-charts/docs/ | ||
curl -sfL https://charts.daystram.com/build.sh | sh -s - folio ${{ env.RELEASE_VERSION }} | ||
curl -sfL https://charts.daystram.com/build.sh | sh -s - ${{ env.APPLICATION }} ${{ env.RELEASE_VERSION }} | ||
rm -rf .daystram/ | ||
git add . | ||
git commit -m "feat: added chart for folio@${{ env.RELEASE_VERSION }}" | ||
git commit -m "feat: added chart for ${{ env.APPLICATION }}@${{ env.RELEASE_VERSION }}" | ||
git push |
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,13 +1,17 @@ | ||
export function validateURL( | ||
urlString: string, | ||
allowInsecure?: boolean, | ||
allowLocalhost?: boolean | ||
): boolean { | ||
const url = new URL(urlString); | ||
return ( | ||
((url.protocol === "http:" && allowInsecure) || | ||
url.protocol === "https:") && | ||
(url.hostname !== "localhost" || !!allowLocalhost) && | ||
url.origin !== null | ||
); | ||
function validate(urlString: string, allowInsecure?: boolean): boolean { | ||
try { | ||
const url = new URL(urlString); | ||
const regex = /^([-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,})$|^(localhost)$/; | ||
return ( | ||
((url.protocol === "http:" && allowInsecure) || | ||
url.protocol === "https:") && | ||
regex.test(url.hostname) && | ||
url.origin !== null | ||
); | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
|
||
export const validateURL = (allowInsecure?: boolean) => (urlString: string) => | ||
validate(urlString, allowInsecure); |
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