chore(goreleaser): adopt new one #214
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
on: | |
push: | |
branches: | |
- '*--auto-release' | |
- master | |
- production | |
name: release | |
jobs: | |
Test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: setup Go 1.12 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.12 | |
id: go | |
- name: check out | |
uses: actions/checkout@master | |
- name: kind create a k8s cluster | |
run: | | |
kind create cluster | |
# - name: lint | |
# run: | | |
# docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint \ | |
# golangci-lint run -v | |
- name: unit test | |
env: | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
run: | | |
# export KUBECONFIG="$(kind get kubeconfig-path)" | |
make unit-test | |
- name: build fx | |
run: | | |
make build | |
- name: test fx cli | |
run: | | |
echo $KUBECONFIG | |
unset KUBECONFIG | |
make cli-test | |
- name: test AKS | |
env: | |
AKS_KUBECONFIG: ${{ secrets.AKS_KUBECONFIG }} | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
echo "skip since aks environment not ready yet" | |
# export KUBECONFIG=${HOME}/.kube/aks | |
# echo ${AKS_KUBECONFIG} | base64 -d > $KUBECONFIG | |
# DEBUG=true ./build/fx up -n hello -p 12345 examples/functions/JavaScript/func.js | |
# ./build/fx down hello | |
# rm ${KUBECONFIG} | |
Release: | |
runs-on: ${{ matrix.os }} | |
needs: [Test] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
# - macOS-latest | |
# - windows-latest | |
version: | |
- latest | |
# - v0.117.0 | |
steps: | |
- name: setup Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: '1.12' | |
- name: checkout | |
uses: actions/checkout@v1 | |
- name: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Minghe Huang" | |
commit=$(git rev-parse --short HEAD) | |
version=$(cat fx.go| grep 'const version' | awk -F'"' '{print $2}') | |
echo "workflow is running on branch ${GITHUB_REF}" | |
if [[ ${GITHUB_REF} == "refs/heads/master" ]];then | |
version=${version}-alpha.${commit} | |
echo "alpha release $version" | |
elif [[ "${GITHUB_REF}" == *--auto-release ]];then | |
version=${version}-alpha.${commit} | |
echo "alpha release $version" | |
elif [[ ${GITHUB_REF} == "refs/heads/production" ]];then | |
echo "official release $version" | |
else | |
echo "skip release on $GITHUB_REF" | |
exit 0 | |
fi | |
git tag -a ${version} -m "auto release" | |
curl -sfL https://goreleaser.com/static/run | bash -- |