diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index c46371d..627a4ef 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -3,7 +3,6 @@ on: push: branches: - "master" - - "develop" pull_request: branches: - "*" @@ -19,7 +18,6 @@ jobs: container_version: ${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.version'] }} container_revision: ${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.revision'] }} container_base: ${{ fromJSON(steps.docker_action_meta.outputs.json).tags[0] }} - new_release_version: ${{ steps.version.outputs.new_release_version }} steps: - name: Checkout uses: actions/checkout@v3 @@ -31,9 +29,6 @@ jobs: run: echo "::set-output name=defined::true" env: MY_KEY: ${{ secrets.DOCKER_PASS }} - - uses: actions/setup-node@v2 - with: - node-version: "14" - name: Docker meta id: docker_action_meta uses: docker/metadata-action@v4.0.1 @@ -44,9 +39,7 @@ jobs: tags: | type=sha,format=long type=sha - type=semver,pattern={{version}},value=${{ steps.version.outputs.new_release_version }} - type=semver,pattern={{major}},value=${{ steps.version.outputs.new_release_version }} - type=semver,pattern={{major}}.{{minor}},value=${{ steps.version.outputs.new_release_version }} + type=match,pattern=s3proxy-(.*),group=1 type=ref,event=branch type=ref,event=pr type=ref,event=tag @@ -60,7 +53,6 @@ jobs: with: submodules: "recursive" - # These steps are quick and will work or if fail only because of external issues - uses: actions/setup-java@v2 with: distribution: "temurin" @@ -74,7 +66,7 @@ jobs: #Run tests - name: Maven Set version run: | - mvn versions:set -DnewVersion=${{ needs.meta.outputs.new_release_version }} + mvn versions:set -DnewVersion=${{ needs.meta.outputs.version }} - name: Maven Package run: | mvn package -DskipTests @@ -99,7 +91,6 @@ jobs: runs-on: ubuntu-latest needs: [runTests, meta] steps: - #Yes we need code - uses: actions/checkout@v2 - uses: actions/download-artifact@v2 with: @@ -109,7 +100,6 @@ jobs: with: name: pom path: . - # These steps are quick and will work or if fail only because of external issues - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx @@ -122,7 +112,7 @@ jobs: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_PASS }} - - name: Login to DockerHub + - name: Login to GHCR uses: docker/login-action@v2.0.0 if: github.event_name != 'pull_request' with: @@ -130,7 +120,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - #Generate Meta - name: Build and push uses: docker/build-push-action@v3 with: @@ -145,37 +134,13 @@ jobs: REVISION=${{ needs.meta.outputs.container_revision }} cache-from: type=registry,ref=${{ needs.meta.outputs.container_base }} cache-to: type=inline - - uses: actions/setup-node@v2 - with: - node-version: "14" - - name: Setup regctl + + - name: Publish to Docker if: github.event_name != 'pull_request' && needs.meta.outputs.dockerhub-publish == 'true' run: | curl -L https://github.com/regclient/regclient/releases/download/v0.3.5/regctl-linux-amd64 >/tmp/regctl chmod 755 /tmp/regctl - - - name: Docker meta - if: github.event_name != 'pull_request' && needs.meta.outputs.dockerhub-publish == 'true' - id: docker_action_meta - uses: docker/metadata-action@v4.0.1 - with: - images: andrewgaul/s3proxy - flavor: | - latest=false - tags: | - type=sha - type=semver,pattern={{version}},value=${{ needs.meta.outputs.new_release_version }} - type=semver,pattern={{major}},value=${{ needs.meta.outputs.new_release_version }} - type=semver,pattern={{major}}.{{minor}},value=${{ needs.meta.outputs.new_release_version }} - type=ref,event=branch - type=ref,event=pr - type=ref,event=tag - labels: | - org.opencontainers.image.licenses=Apache-2.0 - - name: Publish to Docker - if: github.event_name != 'pull_request' && needs.meta.outputs.dockerhub-publish == 'true' - run: | for line in $CONTAINER_DEST_TAGS; do echo working on "$line"; /tmp/regctl image copy $SOURCE_CONTAINER $line; done env: - SOURCE_CONTAINER: ${{ needs.meta.outputs.new_release_version }} - CONTAINER_DEST_TAGS: ${{ steps.docker_action_meta.outputs.tags }} + SOURCE_CONTAINER: ${{ needs.meta.outputs.container_version }} + CONTAINER_DEST_TAGS: ${{ needs.meta.outputs.container_tags }}