try merging checksums #25
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push etcd releases | |
on: | |
push: | |
# Sequence of patterns matched against refs/heads | |
tags: | |
# Push events on datadog tags | |
- "*-dd*" | |
permissions: write-all | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: ["linux/arm64","linux/amd64"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set release version environment variable | |
run: echo RELEASE_VERSION=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV | |
env: | |
GITHUB_REF: ${{ github.ref }} | |
- name: Set target platform environment variable | |
run: echo SANITIZED_TARGET_PLATFORM=${KUBE_BUILD_PLATFORM/\//-} >> $GITHUB_ENV | |
env: | |
KUBE_BUILD_PLATFORM: ${{ matrix.platform }} | |
- name: Build etcd | |
run: REPOSITORY=https://github.com/${{ env.GITHUB_REPOSITORY}}.git ./scripts/build-binary ${{ env.RELEASE_VERSION }} | |
env: | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
- name: Calculate checksums | |
id: calculate_checksums | |
shell: bash | |
working-directory: release/ | |
run: ls . | grep -E '\.tar.gz$|\.zip$' | xargs shasum -a 256 > ./SHA256SUMS | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: etcd_output_${{ env.SANITIZED_TARGET_PLATFORM }} | |
path: release/etcd-${{ env.RELEASE_VERSION }}-${{ env.SANITIZED_TARGET_PLATFORM }}* | |
env: | |
SANITIZED_TARGET_PLATFORM: ${{ env.SANITIZED_TARGET_PLATFORM }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: etcd_output_checksums_${{ env.SANITIZED_TARGET_PLATFORM }} | |
path: release/SHA256SUMS | |
env: | |
SANITIZED_TARGET_PLATFORM: ${{ env.SANITIZED_TARGET_PLATFORM }} | |
- name: Merge checksums | |
uses: actions/upload-artifact/merge@v4 | |
if: always() | |
with: | |
name: etcd_output_checksums | |
pattern: etcd_output_checksums_* | |
delete-merged: true | |
release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: build | |
outputs: | |
upload_url: ${{ steps.create_release_branch.outputs.upload_url }}${{ steps.create_release_tags.outputs.upload_url }} | |
steps: | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
env: | |
GITHUB_REF: ${{ github.ref }} | |
if: startsWith(github.ref, 'refs/heads/') | |
- name: Create Release for Branch | |
id: create_release_branch | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/heads/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: branch@${{ steps.extract_branch.outputs.branch }} | |
tag_name: branch@${{ steps.extract_branch.outputs.branch }} | |
draft: false | |
prerelease: false | |
- name: Extract tags name | |
shell: bash | |
run: echo "##[set-output name=tags;]$(echo ${GITHUB_REF#refs/tags/})" | |
id: extract_tags | |
env: | |
GITHUB_REF: ${{ github.ref }} | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Create Release for Tags | |
id: create_release_tags | |
uses: softprops/action-gh-release@v2 | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ steps.extract_tags.outputs.tags }} | |
tag_name: ${{ steps.extract_tags.outputs.tags }} | |
release_name: ${{ steps.extract_tags.outputs.tags }} | |
draft: false | |
prerelease: false | |
releaseassetsarm: | |
runs-on: ubuntu-latest | |
needs: release | |
strategy: | |
matrix: | |
platform: ["linux-arm64","linux-amd64"] | |
extension: ["tar.gz"] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: etcd_output_${{ matrix.platform }} | |
path: _output/release-tars | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: etcd_output_checksums | |
path: _output/checksums | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set release version environment variable | |
run: echo RELEASE_VERSION=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV | |
env: | |
GITHUB_REF: ${{ github.ref }} | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: _output | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./_output/release-tars/etcd-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}.${{ matrix.extension }} | |
asset_name: etcd-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}.${{ matrix.extension }} | |
asset_content_type: application/tar+gzip | |
- name: Upload checksums | |
id: upload-checksums | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./_output/checksums/SHA256SUMS | |
asset_name: SHA256SUMS | |
asset_content_type: text/plain |