diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 506fb08f..6986b849 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,9 +8,6 @@ on: pull_request: branches: [ master, dev ] -env: - DOCKER_IMAGE: radarbase/radar-schemas-tools - jobs: # Build and test the code java: @@ -45,10 +42,13 @@ jobs: # The type of runner that the job will run on runs-on: ubuntu-latest + env: + DOCKER_IMAGE: radarbase/radar-schemas-tools + # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Docker build parameters id: docker_params @@ -66,7 +66,7 @@ jobs: - name: Cache Docker layers id: cache_buildx - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-${{ steps.docker_params.outputs.push }}-${{ hashFiles('Dockerfile', 'java-sdk/**/*.gradle', 'java-sdk/gradle.properties', 'java-sdk/*/src/main/**', 'commons/**', 'specifications/**', 'docker/**') }} @@ -74,9 +74,9 @@ jobs: ${{ runner.os }}-buildx-${{ steps.docker_params.outputs.push }}- ${{ runner.os }}-buildx- - - name: Login to Docker Hub + - name: Log in to Docker Hub if: steps.docker_params.outputs.has_docker_login == 'true' - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -84,16 +84,16 @@ jobs: # Add Docker labels and tags - name: Docker meta id: docker_meta - uses: crazy-max/ghaction-docker-meta@v2 + uses: docker/metadata-action@v4 with: images: ${{ env.DOCKER_IMAGE }} # Setup docker build environment - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Cache parameters id: cache-parameters @@ -105,8 +105,9 @@ jobs: fi - name: Build docker - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: + context: . cache-from: type=local,src=/tmp/.buildx-cache cache-to: ${{ steps.cache-parameters.outputs.cache-to }} platforms: ${{ steps.docker_params.outputs.platforms }} @@ -134,11 +135,6 @@ jobs: docker run --rm ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} curl --version docker run --rm ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} radar-schemas-tools --help - # Push the image on the dev and master branches - - name: Push image - if: ${{ github.event_name != 'pull_request' }} - run: docker push ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} - # Temp fix # https://github.com/docker/build-push-action/issues/252 # https://github.com/moby/buildkit/issues/1896 diff --git a/.github/workflows/publish_snapshots.yml b/.github/workflows/publish_snapshots.yml index f245b85f..e2b1ba67 100644 --- a/.github/workflows/publish_snapshots.yml +++ b/.github/workflows/publish_snapshots.yml @@ -8,7 +8,7 @@ on: jobs: # Build and test the code - build: + java: # The type of runner that the job will run on runs-on: ubuntu-latest @@ -19,13 +19,13 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Has SNAPSHOT version id: is-snapshot run: grep "version = '.*-SNAPSHOT'" build.gradle - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: temurin java-version: 17 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 424949cb..47ece276 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,9 +17,9 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: temurin java-version: 17 @@ -58,17 +58,12 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - - uses: actions/checkout@v2 - - # Setup docker build environment - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to DockerHub - uses: docker/login-action@v1 + - name: Log in to Docker Hub + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -76,16 +71,23 @@ jobs: # Add Docker labels and tags - name: Docker meta id: docker_meta - uses: crazy-max/ghaction-docker-meta@v2 + uses: docker/metadata-action@v4 with: images: ${{ env.DOCKER_IMAGE }} tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} + # Setup docker build environment + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - name: Build docker - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: + context: . # Allow running the image on X86 and ARM. platforms: linux/amd64,linux/arm64 push: true diff --git a/.github/workflows/scheduled_snyk.yaml b/.github/workflows/scheduled_snyk.yaml index 7cb15aaa..d3923b3e 100644 --- a/.github/workflows/scheduled_snyk.yaml +++ b/.github/workflows/scheduled_snyk.yaml @@ -5,12 +5,14 @@ on: jobs: security: runs-on: ubuntu-latest + defaults: run: working-directory: java-sdk env: REPORT_FILE: test.json + steps: - uses: actions/checkout@v3 - uses: snyk/actions/setup@master