diff --git a/.github/workflows/ci-docker.yaml b/.github/workflows/ci-docker.yaml index 59b54d1..c6a9783 100644 --- a/.github/workflows/ci-docker.yaml +++ b/.github/workflows/ci-docker.yaml @@ -5,22 +5,19 @@ on: branches: - "**" paths-ignore: - - 'docs/**' + - "docs/**" tags: - "**" pull_request: paths-ignore: - - 'docs/**' - -jobs: + - "docs/**" +jobs: lint-docker: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - - - uses: hadolint/hadolint-action@v3.1.0 with: dockerfile: Dockerfile @@ -33,7 +30,11 @@ jobs: contents: read with: ref: ${{ github.ref }} - image-tag: ${{ github.ref }} + image-tag: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag secrets: registry_username: ${{ secrets.DOCKERHUB_USERNAME }} - registry_password: ${{ secrets.DOCKERHUB_TOKEN }} \ No newline at end of file + registry_password: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/ci-go.yaml b/.github/workflows/ci-go.yaml index 322420d..63cdc9f 100644 --- a/.github/workflows/ci-go.yaml +++ b/.github/workflows/ci-go.yaml @@ -5,15 +5,14 @@ on: branches: - "**" paths-ignore: - - 'docs/**' + - "docs/**" tags: - "*" pull_request: paths-ignore: - - 'docs/**' + - "docs/**" jobs: - go: runs-on: ubuntu-latest steps: @@ -22,7 +21,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: '1.23.x' + go-version: "1.23.x" - name: Install dependencies run: go mod download - name: Test with Go @@ -34,8 +33,3 @@ jobs: path: cover.out - name: Build run: go build -v ./... - - name: 'Upload Artifact' - uses: actions/upload-artifact@v4 - with: - name: manager - path: ./bin/manager diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 33700bb..66cdc04 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,7 +10,7 @@ on: image-tag: required: false type: string - secrets: + secrets: registry_username: required: true registry_password: @@ -23,8 +23,8 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: - fetch-depth: 0 # Ensure full history - ref: ${{ github.event.inputs.source_ref }} + fetch-depth: 0 # Ensure full history + ref: ${{ github.event.inputs.source_ref }} - name: Docker meta id: docker_meta @@ -42,8 +42,8 @@ jobs: if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: - username: ${{ github.event.secrets.registry_username }} - password: ${{ github.event.secrets.registry_password }} + username: ${{ secrets.registry_username }} + password: ${{ secrets.registry_password }} - name: Build and push id: build_push @@ -53,7 +53,7 @@ jobs: file: ./Dockerfile push: ${{ github.event_name != 'pull_request' }} tags: | - ${{ github.event.inputs.image-tag }} + ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d640b0..1237907 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,21 +15,19 @@ on: default: false type: boolean - name: Make release jobs: - create-release-branch: runs-on: ubuntu-latest permissions: - contents: write # Allows pushing branches + contents: write # Allows pushing branches steps: - name: Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 0 # Ensure full history - ref: ${{ github.event.inputs.source_ref }} + fetch-depth: 0 # Ensure full history + ref: ${{ github.event.inputs.source_ref }} - name: Configure Git run: | @@ -44,11 +42,8 @@ jobs: git checkout -b $NEW_BRANCH git push origin $NEW_BRANCH - - - build-and-publish-docker: - needs: + needs: - create-release-branch uses: ./.github/workflows/publish.yaml permissions: @@ -56,7 +51,11 @@ jobs: contents: read with: ref: ${{ github.ref }} - image-tag: ${{ github.event.inputs.version }} + image-tag: | + type=semver,pattern={{raw}},value=${{ github.event.inputs.version }} + type=semver,pattern=v{{major}}.{{minor}},value=${{ github.event.inputs.version }} + type=semver,pattern=v{{major}},value=${{ github.event.inputs.version }} + type=raw,value=latest,enable=${{ !github.event.inputs.pre_release }} secrets: registry_username: ${{ secrets.DOCKERHUB_USERNAME }} registry_password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -67,13 +66,12 @@ jobs: needs: - create-release-branch steps: - - name: Checkout code uses: actions/checkout@v4 - + - name: Create Release id: create_release - uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.event.inputs.version }} name: Release ${{ github.event.inputs.version }} @@ -81,4 +79,4 @@ jobs: prerelease: ${{ github.event.inputs.pre_release }} token: ${{ secrets.GITHUB_TOKEN }} generate_release_notes: true - append_body: true \ No newline at end of file + append_body: true