note about updating deps #72
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: CI | |
on: | |
push: | |
tags: | |
- "v*" | |
branches: | |
- master | |
- next | |
jobs: | |
cancel-previous-runs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
build-binary: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '1.22' | |
- shell: bash | |
name: go build | |
run: | | |
ci/build-all.sh | |
env: | |
BINARY_VERSION: docker-image-build | |
- name: upload builds | |
uses: actions/upload-artifact@v2 | |
with: | |
name: builds | |
path: builds/ | |
retention-days: 7 | |
determine-image-tag: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.tag.outputs.tag }} | |
steps: | |
- id: tag | |
run: | | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
export GIT_TAG=${GITHUB_REF#refs/tags/} | |
else | |
export GIT_BRANCH=${GITHUB_REF#refs/heads/} | |
fi | |
if [[ -n "${GIT_TAG}" ]]; then | |
echo "::set-output name=tag::${GIT_TAG}" | |
elif [[ -n "${GIT_BRANCH}" ]]; then | |
if [[ "${GIT_BRANCH}" == "master" ]]; then | |
echo "::set-output name=tag::latest" | |
else | |
echo "::set-output name=tag::${GIT_BRANCH}" | |
fi | |
else | |
: | |
fi | |
build-docker-linux: | |
needs: | |
- build-binary | |
- determine-image-tag | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: builds | |
path: builds/ | |
- name: docker build | |
run: | | |
export ARCH=$([ $(uname -m) = "x86_64" ] && echo "amd64" || echo "arm64") | |
mkdir -p ~/.docker/cli-plugins/ | |
wget -qO ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.8.2/buildx-v0.8.2.linux-${ARCH} | |
chmod a+x ~/.docker/cli-plugins/docker-buildx | |
docker info | |
docker buildx version | |
docker buildx ls | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
docker buildx create --name xbuilder --use | |
docker buildx inspect --bootstrap | |
.github/bin/docker-release.sh | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }} | |
GHCR_PASSWORD: ${{ secrets.GHCR_PASSWORD }} | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
DOCKER_BUILD_PLATFORM: linux/amd64,linux/arm64,linux/arm/v7,linux/s390x,linux/ppc64le | |
IMAGE_TAG: ${{needs.determine-image-tag.outputs.tag}} | |
build-docker-windows: | |
needs: | |
- build-binary | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-2019, windows-2022] | |
include: | |
- os: windows-2019 | |
base_tag: "1809" | |
file: Dockerfile.Windows | |
- os: windows-2022 | |
base_tag: ltsc2022 | |
file: Dockerfile.Windows | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: builds | |
path: builds/ | |
- name: docker build | |
shell: bash | |
run: | | |
docker info | |
docker build --pull -f ${{ matrix.file }} --build-arg BASE_TAG=${{ matrix.base_tag }} -t csi-grpc-proxy-windows:${GITHUB_RUN_ID}-${{ matrix.base_tag }} . | |
docker inspect csi-grpc-proxy-windows:${GITHUB_RUN_ID}-${{ matrix.base_tag }} | |
docker save csi-grpc-proxy-windows:${GITHUB_RUN_ID}-${{ matrix.base_tag }} -o csi-grpc-proxy-windows-${{ matrix.base_tag }}.tar | |
- name: upload image tar | |
uses: actions/upload-artifact@v2 | |
with: | |
name: csi-grpc-proxy-windows-${{ matrix.base_tag }}.tar | |
path: csi-grpc-proxy-windows-${{ matrix.base_tag }}.tar | |
retention-days: 7 | |
push-docker-windows: | |
needs: | |
- build-docker-linux | |
- build-docker-windows | |
- determine-image-tag | |
runs-on: | |
- self-hosted | |
- buildah | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: csi-grpc-proxy-windows-1809.tar | |
- uses: actions/download-artifact@v3 | |
with: | |
name: csi-grpc-proxy-windows-ltsc2022.tar | |
- name: push windows images with buildah | |
run: | | |
#.github/bin/install_latest_buildah.sh | |
buildah version | |
.github/bin/docker-release-windows.sh | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }} | |
GHCR_PASSWORD: ${{ secrets.GHCR_PASSWORD }} | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
IMAGE_TAG: ${{needs.determine-image-tag.outputs.tag}} |