diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0b72dc8e..7474084c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -9,6 +9,11 @@ on: description: 'Tag to use for the build. Example: v1.0.0. *Null = master' required: false default: '' + latest: + description: 'Tag as latest ?' + type: boolean + required: false + default: false concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -67,6 +72,9 @@ jobs: wget https://github.com/protocolbuffers/protobuf/releases/download/v3.20.2/protoc-3.20.2-linux-x86_64.zip unzip protoc-3.20.2-linux-x86_64.zip -d /usr/local rm protoc-3.20.2-linux-x86_64.zip + wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip + unzip awscli-exe-linux-x86_64.zip + ./aws/install - name: Checkout `gear-tech/gear` uses: actions/checkout@v3 @@ -144,6 +152,25 @@ jobs: if-no-files-found: ignore path: ${{ env.ARTIFACT_NAME }} + - name: Update latest symlink for release artifacts (Linux/macOS) + if: > + github.event.inputs.release_version != '' && + github.event.inputs.latest == 'true' && + runner.os != 'Windows' + run: | + latest_artifact=$(aws s3api list-objects --bucket ${{ env.AWS_BUCKET }} --query "reverse(sort_by(Contents, &LastModified))[?contains(Key, 'gear-${{ github.event.inputs.release_version }}-${{ matrix.target }}')].[Key]" --output text) + aws s3api put-object --bucket ${{ env.AWS_BUCKET }} --key gear-latest-${{ matrix.target }}.${{ matrix.file_ext }} --website-redirect-location /$latest_artifact + + - name: Update latest symlink for release artifacts (Windows) + if: > + github.event.inputs.release_version != '' && + github.event.inputs.latest == 'true' && + runner.os == 'Windows' + run: | + $latest_artifact = aws s3api list-objects --bucket ${{ env.AWS_BUCKET }} --query "reverse(sort_by(Contents, &LastModified))[?contains(Key, 'gear-${{ github.event.inputs.release_version }}-${{ matrix.target }}')].[Key]" --output text + aws s3api put-object --bucket ${{ env.AWS_BUCKET }} --key "gear-latest-${{ matrix.target }}.${{ matrix.file_ext }}" --website-redirect-location "/$latest_artifact" + shell: pwsh + publish: name: Publish artifacts needs: build @@ -190,7 +217,7 @@ jobs: