Skip to content

Merge pull request #271 from estesp/migrate-upload-artifact #25

Merge pull request #271 from estesp/migrate-upload-artifact

Merge pull request #271 from estesp/migrate-upload-artifact #25

Workflow file for this run

on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: manifest-tool Release
jobs:
check:
name: Check Signed Tag
runs-on: ubuntu-20.04
timeout-minutes: 5
outputs:
stringver: ${{ steps.contentrel.outputs.stringver }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
path: src/github.com/estesp/manifest-tool
- name: Check signature
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
TAGCHECK=$(git tag -v ${releasever} 2>&1 >/dev/null) ||
echo "${TAGCHECK}" | grep -q "error" && {
echo "::error::tag ${releasever} is not a signed tag. Failing release process."
exit 1
} || {
echo "Tag ${releasever} is signed."
exit 0
}
working-directory: src/github.com/estesp/manifest-tool
- name: Release content
id: contentrel
run: |
RELEASEVER=${{ github.ref }}
echo "::set-output name=stringver::${RELEASEVER#refs/tags/v}"
git tag -l ${RELEASEVER#refs/tags/} -n20000 | tail -n +3 | cut -c 5- >release-notes.md
working-directory: src/github.com/estesp/manifest-tool
- name: Save release notes
uses: actions/upload-artifact@v4
with:
name: mtool-release-notes
path: src/github.com/estesp/manifest-tool/release-notes.md
build:
name: Build binaries
runs-on: ubuntu-20.04
needs: [check]
timeout-minutes: 10
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23.2'
- name: Set env
shell: bash
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Checkout manifest-tool
uses: actions/checkout@v4
with:
repository: estesp/manifest-tool
ref: ${{ github.ref }}
path: src/github.com/estesp/manifest-tool
- name: Make
shell: bash
run: |
make cross
TARFILE="binaries-manifest-tool-${RELEASE_VER#v}.tar.gz"
tar czf ${TARFILE} manifest-tool-*
sha256sum ${TARFILE} >${TARFILE}.sha256sum
working-directory: src/github.com/estesp/manifest-tool
- name: Save build binaries
uses: actions/upload-artifact@v4
with:
name: manifest-tool-binaries
path: src/github.com/estesp/manifest-tool/*.tar.gz*
containers-lx:
name: Build and push Linux release images
runs-on: ubuntu-20.04
needs: [check]
timeout-minutes: 30
steps:
- name: Set env
shell: bash
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Checkout manifest-tool
uses: actions/checkout@v4
with:
repository: estesp/manifest-tool
ref: ${{ github.ref }}
path: src/github.com/estesp/manifest-tool
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Linux containers
shell: bash
run: |
docker buildx build --platform linux/arm/v6 --push -t mplatform/manifest-tool:linux_arm_v6_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/arm/v7 --push -t mplatform/manifest-tool:linux_arm_v7_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/amd64 --push -t mplatform/manifest-tool:linux_amd64_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/arm64 --push -t mplatform/manifest-tool:linux_arm64_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/ppc64le --push -t mplatform/manifest-tool:linux_ppc64le_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/s390x --push -t mplatform/manifest-tool:linux_s390x_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/386 --push -t mplatform/manifest-tool:linux_i386_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/riscv64 --push -t mplatform/manifest-tool:linux_riscv64_${RELEASE_VER} -f hack/Dockerfile.linux .
docker buildx build --platform linux/arm/v6 --push -t mplatform/manifest-tool:alpine_linux_arm_v6_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/arm/v7 --push -t mplatform/manifest-tool:alpine_linux_arm_v7_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/amd64 --push -t mplatform/manifest-tool:alpine_linux_amd64_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/arm64 --push -t mplatform/manifest-tool:alpine_linux_arm64_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/ppc64le --push -t mplatform/manifest-tool:alpine_linux_ppc64le_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/s390x --push -t mplatform/manifest-tool:alpine_linux_s390x_${RELEASE_VER} -f hack/Dockerfile.alpine .
docker buildx build --platform linux/386 --push -t mplatform/manifest-tool:alpine_linux_i386_${RELEASE_VER} -f hack/Dockerfile.alpine .
working-directory: src/github.com/estesp/manifest-tool
containers-win:
name: Build and push Windows release images
runs-on: windows-2019
needs: [check]
timeout-minutes: 30
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23.2'
- name: Set env
shell: bash
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Checkout manifest-tool
uses: actions/checkout@v4
with:
repository: estesp/manifest-tool
ref: ${{ github.ref }}
path: src/github.com/estesp/manifest-tool
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Windows containers
shell: bash
run: |
make binary
docker build -t mplatform/manifest-tool:win2019_${RELEASE_VER} -f hack/Dockerfile.windows .
docker build -t mplatform/manifest-tool:win2016_${RELEASE_VER} -f hack/Dockerfile.windows2016 .
docker push mplatform/manifest-tool:win2019_${RELEASE_VER}
docker push mplatform/manifest-tool:win2016_${RELEASE_VER}
working-directory: src/github.com/estesp/manifest-tool
container-assemble:
name: Assemble and push multi-platform release image
runs-on: ubuntu-20.04
needs: [containers-lx, containers-win]
timeout-minutes: 15
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23.2'
- name: Set env
shell: bash
run: |
releasever=${{ github.ref }}
releasever="${releasever#refs/tags/}"
echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Checkout manifest-tool
uses: actions/checkout@v4
with:
repository: estesp/manifest-tool
ref: ${{ github.ref }}
path: src/github.com/estesp/manifest-tool
- name: Build and push manifest-list
env:
PRERELEASE: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
shell: bash
run: |
TMPROOT=$(mktemp -d)
git clone https://github.com/estesp/manifest-tool.git "${TMPROOT}"/manifest-tool
pushd "${TMPROOT}"/manifest-tool
make binary
sudo make install PREFIX=/usr/local
popd
if [ "${PRERELEASE}" == "true" ]; then
cat hack/pushml-pre.yaml | sed "s,VERS,${RELEASE_VER}," >pushml.yml
else
cat hack/pushml.yaml | sed "s,VERS,${RELEASE_VER}," >pushml.yml
cat hack/pushml-alpine.yaml | sed "s,VERS,${RELEASE_VER}," >pushml-alpine.yml
fi
/usr/local/bin/manifest-tool push from-spec pushml.yml
/usr/local/bin/manifest-tool push from-spec pushml-alpine.yml
working-directory: src/github.com/estesp/manifest-tool
release:
name: Create manifest-tool Release
runs-on: ubuntu-20.04
timeout-minutes: 10
needs: [build, check]
steps:
- name: Download builds and release notes
uses: actions/[email protected]
with:
path: builds
- name: Catalog build assets for upload
id: catalog
run: |
_filenum=1
for f in `ls builds/manifest-tool-binaries`; do
echo "::set-output name=file${_filenum}::${f}"
let "_filenum+=1"
done
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: manifest-tool ${{ needs.check.outputs.stringver }}
body_path: ./builds/mtool-release-notes/release-notes.md
draft: false
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
- name: Upload binaries tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./builds/manifest-tool-binaries/${{ steps.catalog.outputs.file1 }}
asset_name: ${{ steps.catalog.outputs.file1 }}
asset_content_type: application/gzip
- name: Upload sha256 sum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./builds/manifest-tool-binaries/${{ steps.catalog.outputs.file2 }}
asset_name: ${{ steps.catalog.outputs.file2 }}
asset_content_type: text/plain