-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
03d6481
commit 250407b
Showing
5 changed files
with
108 additions
and
56 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 |
---|---|---|
@@ -1,78 +1,104 @@ | ||
name: Release & Docker | ||
name: sonorV2 Branch CI - Build release candidate | ||
|
||
on: | ||
push: | ||
branches: | ||
- sonorV2 | ||
|
||
jobs: | ||
install: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release-version: ${{ steps.version.outputs.pe-version }} | ||
tag-already-exists: ${{ steps.checkTag.outputs.exists }} | ||
steps: | ||
- name: Use Node.js 14C | ||
uses: actions/setup-node@v1 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get version | ||
id: version | ||
run: echo "pe-version=$(cat package.json | jq -r '.version')-experimental" >> $GITHUB_OUTPUT | ||
|
||
- name: Print version | ||
run: echo ${{ steps.version.outputs.pe-version }} | ||
|
||
- uses: mukunku/[email protected] | ||
id: checkTag | ||
with: | ||
node-version: 18 | ||
- run: yarn --frozen-lockfile | ||
build: | ||
tag: ${{ steps.version.outputs.pe-version }} | ||
|
||
- if: ${{ steps.checkTag.outputs.exists == 'true' }} | ||
name: "Skip release" | ||
run: echo "Nothing to tag/release, the release ${{ steps.version.outputs.pe-version }} already exists" | ||
|
||
create-release: | ||
needs: check-version | ||
runs-on: ubuntu-latest | ||
if: ${{ needs.check-version.outputs.tag-already-exists == 'false' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.ref }} | ||
fetch-depth: 0 | ||
|
||
- name: Get previous tag | ||
id: previousTag | ||
run: echo "previousTag=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | grep '^[0-9]\+\.[0-9]\+\.[0-9]\+\-experimental$' | tail -1)" >> $GITHUB_OUTPUT | ||
|
||
- uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ needs.check-version.outputs.release-version }} | ||
target_commitish: ${{ github.head_ref || github.ref }} | ||
name: ${{ needs.check-version.outputs.release-version }} | ||
body: ${{steps.changelog.outputs.changes}} | ||
prerelease: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build-release: | ||
needs: create-release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Extract branch name | ||
shell: bash | ||
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT | ||
id: extract_branch | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ steps.extract_branch.outputs.branch }} | ||
|
||
- name: Use Node.js 18 | ||
uses: actions/setup-node@v1 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- run: yarn | ||
- run: yarn build | ||
|
||
- name: Upload build | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build | ||
path: dist | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout current branch | ||
uses: actions/checkout@v2 | ||
- name: Get current version | ||
id: version | ||
uses: notiz-dev/github-action-json-property@release | ||
with: | ||
path: "package.json" | ||
prop_path: "version" | ||
- run: echo ${{steps.version.outputs.prop}} | ||
- name: Release snapshot | ||
id: release-snapshot | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{steps.version.outputs.prop}} | ||
release_name: ${{steps.version.outputs.prop}} | ||
draft: false | ||
prerelease: false | ||
docker: | ||
needs: build | ||
needs: | ||
- check-version | ||
- build-release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Download build | ||
id: download | ||
uses: actions/download-artifact@v2 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: build | ||
path: dist | ||
- name: Get current version | ||
id: version | ||
uses: notiz-dev/github-action-json-property@release | ||
with: | ||
path: "package.json" | ||
prop_path: "version" | ||
- run: echo ${{steps.version.outputs.prop}} | ||
|
||
- name: Publish to Registry | ||
uses: elgohr/Publish-Docker-Github-Action@master | ||
uses: elgohr/Publish-Docker-Github-Action@v5 | ||
with: | ||
name: inseefr/pearl-jam | ||
name: inseefr/sonor | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
tags: ${{steps.version.outputs.prop}} | ||
tags: "latest, ${{ needs.check-version.outputs.release-version }}" |
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,16 +1,35 @@ | ||
FROM nginx | ||
FROM nginx:stable-alpine | ||
|
||
## Remove default nginx index page | ||
RUN rm -rf /usr/share/nginx/html/* | ||
|
||
#Add build to nginx root webapp | ||
ADD dist /usr/share/nginx/html | ||
|
||
#Copy nginx configuration | ||
RUN rm etc/nginx/conf.d/default.conf | ||
# Overload nginx.conf to enable cors | ||
COPY nginx.conf etc/nginx/conf.d/ | ||
COPY container/nginx.conf etc/nginx/conf.d/ | ||
|
||
|
||
# Copy .env file and shell script to container | ||
WORKDIR /usr/share/nginx/html | ||
COPY ./scripts/env.sh . | ||
COPY .env . | ||
|
||
# Make shell script executable | ||
# Add bash | ||
RUN apk add --no-cache bash | ||
|
||
COPY scripts/env.sh . | ||
COPY scripts/.env . | ||
|
||
# Make our shell script executable | ||
RUN chmod +x env.sh | ||
|
||
# add non-root user | ||
RUN touch /var/run/nginx.pid | ||
RUN chown -R nginx:nginx /var/run/nginx.pid /usr/share/nginx/html /var/cache/nginx /var/log/nginx /etc/nginx/conf.d | ||
|
||
# non root users cannot listen on 80 | ||
EXPOSE 8080 | ||
|
||
USER nginx | ||
|
||
# Start Nginx server | ||
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""] | ||
ENTRYPOINT bash -c "/usr/share/nginx/html/env.sh && nginx -g 'daemon off;'" |
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,5 +1,5 @@ | ||
server { | ||
listen 80 default_server; | ||
listen 8080; | ||
server_name /usr/share/nginx/html; | ||
|
||
root /usr/share/nginx/html; | ||
|
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,5 @@ | ||
VITE_API_ENDPOINT=https://localhost:8080 | ||
VITE_AUTH_TYPE=oidc | ||
VITE_OIDC_CLIENT_ID=localhost-frontend | ||
VITE_OIDC_ISSUER=https://localhost:8080 | ||
VITE_LOCALE=fr |
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