From 74cf71e29989574c72c6330a06cb6edd1b0a3547 Mon Sep 17 00:00:00 2001 From: syntrust Date: Tue, 28 Nov 2023 19:14:14 +0800 Subject: [PATCH] add tag --- .github/workflows/publish.yml | 80 ++++++++++++++++------------------- 1 file changed, 36 insertions(+), 44 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f825366f..768fec65 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,48 +4,46 @@ name: GitHub Actions ES Publish run-name: ${{ github.actor }} is publishing a release 🚀 on: push: - # tags: - # - 'v*' - branches: ['build'] # TODO: remove + tags: + - 'v*' env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: - # TODO: uncomment - # build: - # runs-on: ubuntu-latest - # steps: - # - name: Checkout code - # uses: actions/checkout@v3 + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 - # - name: Set up Go - # uses: actions/setup-go@v4 - # with: - # go-version: '1.20' + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' - # - name: Build - # run: | - # make TARGETOS=linux TARGETARCH=amd64 - # mv cmd/es-node/es-node es-node.${{github.ref_name}}.linux-amd64 - # make TARGETOS=darwin TARGETARCH=amd64 - # mv cmd/es-node/es-node es-node.${{github.ref_name}}.darwin-amd64 - # make TARGETOS=darwin TARGETARCH=arm64 - # mv cmd/es-node/es-node es-node.${{github.ref_name}}.darwin-arm64 - # make TARGETOS=windows TARGETARCH=amd64 - # mv cmd/es-node/es-node es-node.${{github.ref_name}}.windows-amd64 + - name: Build + run: | + make TARGETOS=linux TARGETARCH=amd64 + mv cmd/es-node/es-node es-node.${{github.ref_name}}.linux-amd64 + make TARGETOS=darwin TARGETARCH=amd64 + mv cmd/es-node/es-node es-node.${{github.ref_name}}.darwin-amd64 + make TARGETOS=darwin TARGETARCH=arm64 + mv cmd/es-node/es-node es-node.${{github.ref_name}}.darwin-arm64 + make TARGETOS=windows TARGETARCH=amd64 + mv cmd/es-node/es-node es-node.${{github.ref_name}}.windows-amd64 - # - name: Create Release - # uses: softprops/action-gh-release@v1 - # with: - # tag_name: ${{ github.ref }} - # name: Release ${{github.ref_name}} - # files: | - # es-node.${{github.ref_name}}.linux-amd64 - # es-node.${{github.ref_name}}.darwin-amd64 - # es-node.${{github.ref_name}}.darwin-arm64 - # es-node.${{github.ref_name}}.windows-amd64 - # generate_release_notes: true + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.ref }} + name: Release ${{github.ref_name}} + files: | + es-node.${{github.ref_name}}.linux-amd64 + es-node.${{github.ref_name}}.darwin-amd64 + es-node.${{github.ref_name}}.darwin-arm64 + es-node.${{github.ref_name}}.windows-amd64 + generate_release_notes: true build-and-push-image: runs-on: ubuntu-latest @@ -55,13 +53,6 @@ jobs: packages: write # steps: - # TODO remove - # - name: delete package - # uses: actions/delete-package-versions@v4 - # with: - # package-name: 'es-node' - # package-type: 'container' - - name: Checkout repository uses: actions/checkout@v4 @@ -73,7 +64,6 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - visibility: public # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. # The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. @@ -93,5 +83,7 @@ jobs: with: context: . push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} + tags: | + ${{ steps.meta.outputs.tags }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ No newline at end of file