Bump actions/download-artifact from 1 to 4.1.7 in /.github/workflows #61
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-CD | |
on: push | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- run: | | |
git fetch --tags | |
git branch --create-reflog master origin/master | |
- name: Set GitVersion file | |
uses: docker://gittools/gitversion:5.0.2-linux | |
with: | |
args: '-nocache -output buildserver -exec /bin/bash -execargs "-c \"echo $GitVersion_FullSemVer > /github/workspace/version.txt\""' | |
- name: Set GitVersion environment variable | |
run: | | |
echo ::set-env name=VERSION::$(cat version.txt) | |
- name: Set GO environment variables | |
run: | | |
GOPATH=$RUNNER_WORKSPACE/go | |
GOBIN=$GOPATH/bin | |
mkdir -p $GOBIN | |
echo ::set-env name=GOPATH::$GOPATH | |
echo ::set-env name=GOBIN::$GOBIN | |
echo ::add-path::$GOBIN | |
- name: Setup GO | |
uses: actions/setup-go@v1 | |
with: | |
go-version: '1.15' | |
- name: Move project to GO workspace | |
run: | | |
GOPROJECT=$GOPATH/src/github.com/$GITHUB_REPOSITORY | |
echo "Moving $GITHUB_WORKSPACE to $GOPROJECT" | |
mkdir -p $GOPROJECT | |
cp -a $GITHUB_WORKSPACE/. $GOPROJECT | |
echo ::set-env name=GOPROJECT::$GOPROJECT | |
- name: Bootstrap, test & build | |
run: | | |
cd $GOPROJECT | |
make bootstrap test build-release | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: binaries | |
path: ${{ runner.workspace }}/go/src/github.com/${{ github.repository}}/bin | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/[email protected] | |
with: | |
name: binaries | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: binaries/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Authenticate against Azure Container Registry (docker registry) | |
uses: azure/docker-login@v1 | |
with: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
login-server: ${{ secrets.REGISTRY_SERVER }} | |
- name: Docker build & publish | |
run: | | |
cd $GITHUB_WORKSPACE/docker | |
VERSION=${GITHUB_REF#refs/tags/} | |
docker build --build-arg CNAB_ARM_DRIVER_VERSION=$VERSION --build-arg CNAB_ARM_DRIVER_REPO=$GITHUB_REPOSITORY . -t cnabquickstarts.azurecr.io/cnabarmdriver:$VERSION | |
docker push cnabquickstarts.azurecr.io/cnabarmdriver:$VERSION | |
docker build --build-arg CNAB_ARM_DRIVER_VERSION=$VERSION --build-arg CNAB_ARM_DRIVER_REPO=$GITHUB_REPOSITORY . -t cnabquickstarts.azurecr.io/cnabarmdriver:latest | |
docker push cnabquickstarts.azurecr.io/cnabarmdriver:latest | |