feat: add view rules on report component #45
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
name: Release | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
verify-version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get_version.outputs.VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get the version | |
id: get_version | |
run: "echo ::set-output name=VERSION::$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')" | |
- name: Test snapshot | |
run: if [[ "${{ steps.get_version.outputs.VERSION }}" == *"-SNAPSHOT" ]]; then exit 1; else exit 0; fi | |
- name: Get release | |
id: get_release | |
run: echo ::set-output name=RELEASE_HTTP_CODE::$(curl -s -o out.html -w '%{http_code}' https://github.com/les-projets-cagnottes/web/releases/tag/${{ steps.get_version.outputs.VERSION }};) | |
- name: Test release existence | |
run: if [[ "${{ steps.get_release.outputs.RELEASE_HTTP_CODE }}" -eq "200" ]]; then exit 1; else exit 0; fi | |
build: | |
needs: verify-version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- run: npm ci | |
- run: npm run build --if-present | |
release: | |
needs: [verify-version, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Config Git | |
run: git config user.email "${{ secrets.GIT_CONFIG_EMAIL }}" && git config user.name "${{ secrets.GIT_CONFIG_NAME }}" | |
- run: git tag ${{ needs.verify-version.outputs.version }} | |
- run: git push origin ${{ needs.verify-version.outputs.version }} | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.verify-version.outputs.version }} | |
release_name: ${{ needs.verify-version.outputs.version }} | |
body: | | |
Release ${{ needs.verify-version.outputs.version }} | |
draft: false | |
prerelease: false | |
publish-docker: | |
needs: [verify-version, release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ needs.verify-version.outputs.version }}' | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --build-arg configuration=production --tag web:latest | |
- name: Tag the image for Docker Hub | |
run: docker tag web:latest lesprojetscagnottes/web:${{ needs.verify-version.outputs.version }} | |
- name: Tag the latest image for Docker Hub | |
run: docker tag web:latest lesprojetscagnottes/web:latest | |
- name: Login to Docker Hub | |
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
- name: Publish to Docker Hub | |
run: docker push lesprojetscagnottes/web:${{ needs.verify-version.outputs.version }} | |
- name: Publish latest version to Docker Hub | |
run: docker push lesprojetscagnottes/web:latest |