chore: Cleanup dependency suppress file #310
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: build | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- 'v*.*.*' | |
paths-ignore: | |
- '.talismanrc' | |
- '*.md' | |
env: | |
SERVICE_NAME: gitactionboard | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout local repository | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ github.workspace }}/${{ env.SERVICE_NAME }} | |
- name: Install nvm at specific version | |
run: | | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | |
- name: Install prettier using npm | |
run: sudo npm install --global prettier | |
- name: Install jenv | |
run: | | |
git clone https://github.com/gcuisinier/jenv.git ~/.jenv | |
echo "$HOME/.jenv/bin" >> $GITHUB_PATH | |
- name: Configure jenv | |
run: | | |
jenv init - | |
jenv add ${JAVA_HOME_21_X64} | |
- name: Install Hadolint and add to PATH | |
run: | | |
sh bin/install-hadolint.sh | |
echo "$GITHUB_WORKSPACE/$SERVICE_NAME" >> $GITHUB_PATH | |
working-directory: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/ | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache gradle wrapper and jars | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-${{ steps.get-date.outputs.date }}- | |
${{ runner.os }}-gradle- | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ steps.get-date.outputs.date }}- | |
${{ runner.os }}-node- | |
${{ runner.os }}- | |
- name: Cache pitest history | |
uses: pat-s/[email protected] | |
with: | |
path: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/backend/pitestHistory/pitestHistory | |
key: pitestHistory-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
pitestHistory-${{ steps.get-date.outputs.date }}- | |
pitestHistory- | |
- name: Run all tests | |
run: ./run.sh test | |
working-directory: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/ | |
- name: Run Mutation test for backend | |
run: ./run.sh pitest | |
working-directory: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/ | |
- name: Upload build report to artifacts | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: ${{ env.SERVICE_NAME }}-build-reports | |
path: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/backend/build/reports/ | |
determaine_should_publish_new_version: | |
runs-on: ubuntu-22.04 | |
outputs: | |
PUBLISH_NEW_VERSION: ${{ steps.determaine_should_publish_new_version.outputs.PUBLISH_NEW_VERSION }} | |
steps: | |
- name: Checkout local repository | |
uses: actions/checkout@v4 | |
- name: Determine should publish docker image | |
id: determaine_should_publish_new_version | |
run: | | |
PUBLISH_NEW_VERSION=false | |
if [[ $(git tag --points-at HEAD) != '' ]]; then | |
PUBLISH_NEW_VERSION=true | |
fi | |
echo "PUBLISH_NEW_VERSION=${PUBLISH_NEW_VERSION}" >> $GITHUB_OUTPUT | |
determaine_current_tag_name: | |
runs-on: ubuntu-22.04 | |
needs: [ build, determaine_should_publish_new_version ] | |
if: ${{ needs.determaine_should_publish_new_version.outputs.PUBLISH_NEW_VERSION == 'true' }} | |
outputs: | |
CURRENT_TAG: ${{ steps.find_current_tag_name.outputs.CURRENT_TAG }} | |
steps: | |
- name: Checkout local repository | |
uses: actions/checkout@v4 | |
- name: Determine current tag | |
id: find_current_tag_name | |
run: | | |
CURRENT_TAG=$(git describe --tags --abbrev=0) | |
echo "CURRENT_TAG=${CURRENT_TAG}" >> $GITHUB_OUTPUT | |
update_changelog: | |
runs-on: ubuntu-22.04 | |
needs: [ build, determaine_should_publish_new_version, determaine_current_tag_name ] | |
if: ${{ needs.determaine_should_publish_new_version.outputs.PUBLISH_NEW_VERSION == 'true' }} | |
outputs: | |
CHANGE_LOG_URL: ${{ steps.create_change_log_url.outputs.CHANGE_LOG_URL }} | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout local repository | |
uses: actions/checkout@v4 | |
with: | |
ref: 'main' | |
fetch-depth: 0 | |
path: ${{ github.workspace }}/${{ env.SERVICE_NAME }} | |
- name: Install nvm at specific version | |
run: | | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | |
- name: Install git-cliff and prettier using npm | |
run: sudo npm install --global git-cliff prettier | |
- name: Generate changelog | |
run: ./run.sh generate-changelog | |
working-directory: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/ | |
- name: Commit and push updated changelog | |
run: | | |
git add . | |
if ! (git diff --staged --quiet --exit-code); then | |
git config user.name "GitHub Actions" | |
git commit -m 'docs: Update changelog' | |
git push origin main | |
fi | |
working-directory: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/ | |
- name: Create change log url | |
id: create_change_log_url | |
run: | | |
echo "CHANGE_LOG_URL=$(./run.sh generate-changelog-url ${{ needs.determaine_current_tag_name.outputs.CURRENT_TAG }})" >> $GITHUB_OUTPUT | |
working-directory: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/ | |
docker: | |
runs-on: ubuntu-22.04 | |
needs: [ build, determaine_current_tag_name, update_changelog ] | |
steps: | |
- name: Checkout local repository | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ github.workspace }}/${{ env.SERVICE_NAME }} | |
- name: Install jenv | |
run: | | |
git clone https://github.com/gcuisinier/jenv.git ~/.jenv | |
echo "$HOME/.jenv/bin" >> $GITHUB_PATH | |
- name: Configure jenv | |
run: | | |
jenv init - | |
jenv add ${JAVA_HOME_21_X64} | |
- name: Install nvm at specific version | |
run: | | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache gradle wrapper and jars | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-${{ steps.get-date.outputs.date }}- | |
${{ runner.os }}-gradle- | |
- name: Build boot jar | |
id: build_jar | |
run: ./run.sh build-jar | |
working-directory: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/ | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.SERVICE_NAME }} | |
tags: | | |
type=semver,pattern={{major}}.{{minor}}.{{patch}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: create github release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "${{ github.workspace }}/${{ env.SERVICE_NAME }}/backend/build/libs/gitactionboard.jar" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: "${{ needs.determaine_current_tag_name.outputs.CURRENT_TAG }}" | |
body: "Changelog can be found [here](${{ needs.update_changelog.outputs.CHANGE_LOG_URL }})." | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ github.workspace }}/${{ env.SERVICE_NAME }} | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
- name: Update docker hub description | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
repository: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.SERVICE_NAME }} | |
readme-filepath: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/README.md | |
deploy_to_github_pages: | |
runs-on: ubuntu-22.04 | |
needs: [ docker ] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout local repository | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ github.workspace }}/${{ env.SERVICE_NAME }} | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
with: | |
enablement: true | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Install nvm at specific version | |
run: | | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ steps.get-date.outputs.date }}- | |
${{ runner.os }}-node- | |
${{ runner.os }}- | |
- name: Build frontend | |
run: ./run.sh frontend-build-for-github-pages | |
working-directory: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/ | |
- name: Upload site artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "${{ github.workspace }}/${{ env.SERVICE_NAME }}/frontend/dist" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |