fix effective date #16
This file contains hidden or 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 workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| name: Release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| permissions: write-all | |
| strategy: | |
| max-parallel: 1 | |
| concurrency: | |
| group: ${{ github.ref }} | |
| cancel-in-progress: true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Set up Node 22 | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Bump version and push tag | |
| id: github_tag_action | |
| uses: anothrNick/[email protected] | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TAGGING_GITHUB_TOKEN }} | |
| WITH_V: true | |
| - name: Extract tag | |
| id: extract_tag | |
| run: | | |
| raw_tag=${{ steps.github_tag_action.outputs.new_tag }} | |
| tag=${raw_tag:1} | |
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | |
| echo "Successfully extracted tag $tag" | |
| - name: Extract back-end maven artifactId | |
| id: extract_backend_artifact_id | |
| run: | | |
| artifactId=$(mvn -pl artist-insight-service help:evaluate "-Dexpression=project.artifactId" -q -DforceStdout) | |
| echo "artifactId=$artifactId" >> "$GITHUB_OUTPUT" | |
| echo "Successfully extracted artifactId $artifactId" | |
| - name: Extract front-end npm packageName | |
| id: extract_frontend_package_name | |
| run: | | |
| packageName=$(cut -d "=" -f 2 <<< $(npm run --prefix frontend/ env | grep "npm_package_name")) | |
| echo "packageName=$packageName" >> "$GITHUB_OUTPUT" | |
| echo "Successfully extracted packageName $packageName" | |
| - name: Build back-end with Maven & create docker image | |
| run: | | |
| mvn -v | |
| mvn -B -P docker clean package -DskipTests | |
| - name: Build front-end with npm | |
| run: | | |
| npm install --prefix frontend/ | |
| - name: Build front-end docker image | |
| run: | | |
| tag=${{ steps.extract_tag.outputs.tag }} | |
| docker build -t generaltao725/artist-insight-frontend -t generaltao725/artist-insight-frontend:$tag frontend/ | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Push front-end image to DockerHub | |
| run: | | |
| username=${{ secrets.DOCKER_USERNAME }} | |
| packageName=${{ steps.extract_frontend_package_name.outputs.packageName }} | |
| tag=${{ steps.extract_tag.outputs.tag }} | |
| docker push "$username/$packageName:$tag" | |
| docker push "$username/$packageName:latest" | |
| - name: Push back-end image to DockerHub | |
| run: | | |
| username=${{ secrets.DOCKER_USERNAME }} | |
| artifactId=${{ steps.extract_backend_artifact_id.outputs.artifactId }} | |
| tag=${{ steps.extract_tag.outputs.tag }} | |
| docker push "$username/$artifactId:$tag" | |
| docker push "$username/$artifactId:latest" |