diff --git a/.github/workflows/generate-pgo.yaml b/.github/workflows/generate-pgo.yaml index 1b68b9e..a986f28 100644 --- a/.github/workflows/generate-pgo.yaml +++ b/.github/workflows/generate-pgo.yaml @@ -14,7 +14,7 @@ env: PGO_BRANCH: "pgo" jobs: - tests: + generate-pgo: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -24,7 +24,7 @@ jobs: go-version-file: 'go.mod' cache-dependency-path: '**/go.sum' - - run: make pprof && cp ${{ env.PGO_FILE }} /tmp/ + - run: make pgo && cp ${{ env.PGO_FILE }} /tmp/ - uses: actions/checkout@v3 with: diff --git a/.github/workflows/release-publish.yaml b/.github/workflows/release-publish.yaml deleted file mode 100644 index a0d9537..0000000 --- a/.github/workflows/release-publish.yaml +++ /dev/null @@ -1,63 +0,0 @@ -name: Release & Publish - -on: - push: - tags: ["v*.*.**"] - workflow_dispatch: - inputs: - tag: - description: "Target tag to release/publish" - required: true - type: string - job: - description: "Choose job to run" - required: true - default: 'both' - type: choice - options: - - both - - release - - publish - -jobs: - release: - name: goreleaser-cross - runs-on: ubuntu-latest - container: - image: ghcr.io/goreleaser/goreleaser-cross:latest - if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && (inputs.job == 'release' || inputs.job == 'both')) }} - steps: - - uses: actions/checkout@master - with: - ref: "${{ inputs.tag || github.ref_name }}" - - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - - run: git config --global --add safe.directory "$(pwd)" - - - run: goreleaser release - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - publish: - name: publish images - runs-on: ubuntu-latest - if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && (inputs.job == 'publish' || inputs.job == 'both')) }} - steps: - - uses: actions/checkout@master - with: - ref: "${{ inputs.tag || github.ref_name }}" - - - uses: docker/login-action@v3.1.0 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - uses: docker/build-push-action@v5.3.0 - with: - push: true - build-args: "VERSION=${{ inputs.tag || github.ref_name }}" - tags: "ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ inputs.tag || github.ref_name }}" \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..834b0de --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,44 @@ +name: Release + +on: + push: + tags: ["v*.*.**"] + workflow_dispatch: + inputs: + tag: + description: "Target tag to release" + required: true + type: string + +env: + PGO_FILE: "default.pgo" + +jobs: + release: + runs-on: ubuntu-latest + container: + image: ghcr.io/goreleaser/goreleaser-cross:latest + steps: + - uses: actions/checkout@master + with: + ref: "${{ inputs.tag || github.ref_name }}" + + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + cache-dependency-path: '**/go.sum' + + - uses: actions/download-artifact@v4 + id: artifact + with: + name: pgo + continue-on-error: true + + - name: Build PGO file + run: '[ -f "${{ env.PGO_FILE }}" ] || make pgo' + + - run: git config --global --add safe.directory "$(pwd)" + + - run: goreleaser release --clean + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b81c897..f36a46b 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -124,12 +124,12 @@ changelog: dockers: - image_templates: - - "ghcr.io/kitabisa/{{ .ProjectName }}:{{ .Tag }}" - - "ghcr.io/kitabisa/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}" - - "ghcr.io/kitabisa/{{ .ProjectName }}:v{{ .Major }}" - - "ghcr.io/kitabisa/{{ .ProjectName }}:latest" - dockerfile: Dockerfile - use: docker - build_flag_templates: - - "--pull" - - "--build-arg=VERSION={{ .Tag }}" + - "ghcr.io/kitabisa/{{ .ProjectName }}:{{ .Tag }}" + - "ghcr.io/kitabisa/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}" + - "ghcr.io/kitabisa/{{ .ProjectName }}:v{{ .Major }}" + - "ghcr.io/kitabisa/{{ .ProjectName }}:latest" + dockerfile: Dockerfile + use: docker + build_flag_templates: + - "--pull" + - "--build-arg=VERSION={{ .Tag }}"