Bump postcss and @angular-devkit/build-angular in /web #384
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
# ------------------------------------------------------------ | |
# Copyright 2021 The Dapr Authors | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# ------------------------------------------------------------ | |
name: Build | |
on: | |
push: | |
branches: | |
- master | |
- release-* | |
tags: | |
- v* | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: | |
- master | |
- release-* | |
paths-ignore: | |
- '**.md' | |
jobs: | |
build: | |
name: Build ${{ matrix.target_os }}_${{ matrix.target_arch }} binaries | |
runs-on: ${{ matrix.os }} | |
env: | |
GOVER: 1.19 | |
GOLANGCILINT_VER: 1.50.1 | |
GOOS: ${{ matrix.target_os }} | |
GOARCH: ${{ matrix.target_arch }} | |
GOPROXY: https://proxy.golang.org | |
NODE_VERSION: 16.x | |
ARTIFACTS_DIR: release/artifacts | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
target_arch: [arm, arm64, amd64] | |
include: | |
- os: ubuntu-latest | |
target_os: linux | |
- os: windows-latest | |
target_os: windows | |
- os: macOS-latest | |
target_os: darwin | |
exclude: | |
- os: windows-latest | |
target_arch: arm | |
- os: macOS-latest | |
target_arch: arm | |
- os: windows-latest | |
target_arch: arm64 | |
steps: | |
- name: Setup node ${{ env.NODE_VERSION }} and npm | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install angular cli | |
run: npm install -g @angular/cli | |
- name: Set up Go ${{ env.GOVER }} | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GOVER }} | |
- name: Install golangci-lint | |
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' | |
run: | | |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${{ env.GOROOT }}/bin" v${{ env.GOLANGCILINT_VER }} | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Parse release version and set REL_VERSION | |
run: python ./.github/scripts/get_release_version.py | |
- name: Run make lint | |
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' | |
run: make lint | |
- name: Run make test | |
env: | |
COVERAGE_OPTS: "-coverprofile=coverage.txt -covermode=atomic" | |
if: matrix.target_arch == 'amd64' | |
run: make test | |
- name: Codecov | |
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' | |
uses: codecov/codecov-action@v1 | |
- name: Run make release to build and archive binaries | |
run: | | |
mkdir -p ${{ env.ARTIFACTS_DIR }} | |
make release GOOS=${{ matrix.target_os }} GOARCH=${{ matrix.target_arch }} ARCHIVE_OUT_DIR=${{ env.ARTIFACTS_DIR }} | |
- name: upload artifacts | |
uses: actions/upload-artifact@master | |
with: | |
name: dashboard_${{ matrix.target_os }}_${{ matrix.target_arch }} | |
path: ${{ env.ARTIFACTS_DIR }} | |
- name: docker login | |
if: matrix.target_os != 'darwin' && github.event_name != 'pull_request' | |
run: | | |
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }} | |
- name: Build and push docker images to Docker Hub | |
if: matrix.target_os != 'darwin' && github.event_name != 'pull_request' | |
run: | | |
echo "Build docker image and push image..." | |
make docker-push TARGET_OS=${{ matrix.target_os }} TARGET_ARCH=${{ matrix.target_arch }} DAPR_REGISTRY=${{ secrets.DOCKER_DAPRIO_REGISTRY }} DAPR_TAG=${{ env.REL_VERSION }} | |
- name: GitHub container registry login | |
if: matrix.target_os != 'darwin' && github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push docker images to ghcr | |
if: matrix.target_os != 'darwin' && github.event_name != 'pull_request' | |
run: | | |
echo echo "Build docker image and push image..." | |
make docker-push TARGET_OS=${{ matrix.target_os }} TARGET_ARCH=${{ matrix.target_arch }} DAPR_REGISTRY=ghcr.io/${{ github.repository_owner }} DAPR_TAG=${{ env.REL_VERSION }} | |
publish: | |
name: Publish docker image and binaries | |
needs: build | |
if: github.event_name != 'pull_request' | |
env: | |
ARTIFACTS_DIR: ./release | |
DAPR_VERSION_ARTIFACT: dapr_version | |
DOCKER_REGISTRY: ${{ secrets.DOCKER_DAPRIO_REGISTRY }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Install Docker CE for buildx | |
run: | | |
sudo apt update | |
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
sudo apt update | |
sudo apt install docker-ce | |
docker -v | |
- name: Parse release version and set REL_VERSION | |
run: python ./.github/scripts/get_release_version.py | |
- name: download artifacts - dapr_linux_amd64 | |
uses: actions/download-artifact@master | |
with: | |
name: dashboard_linux_amd64 | |
path: ${{ env.ARTIFACTS_DIR }} | |
- name: download artifacts - dapr_linux_arm | |
uses: actions/download-artifact@master | |
with: | |
name: dashboard_linux_arm | |
path: ${{ env.ARTIFACTS_DIR }} | |
- name: download artifacts - dapr_linux_arm64 | |
uses: actions/download-artifact@master | |
with: | |
name: dashboard_linux_arm64 | |
path: ${{ env.ARTIFACTS_DIR }} | |
- name: download artifacts - dapr_windows_amd64 | |
uses: actions/download-artifact@master | |
with: | |
name: dashboard_windows_amd64 | |
path: ${{ env.ARTIFACTS_DIR }} | |
- name: download artifacts - dapr_darwin_amd64 | |
uses: actions/download-artifact@master | |
with: | |
name: dashboard_darwin_amd64 | |
path: ${{ env.ARTIFACTS_DIR }} | |
- name: download artifacts - dapr_darwin_arm64 | |
uses: actions/download-artifact@master | |
with: | |
name: dashboard_darwin_arm64 | |
path: ${{ env.ARTIFACTS_DIR }} | |
- name: generate checksum files | |
run: cd ${ARTIFACTS_DIR} && for i in *; do sha256sum -b $i > "$i.sha256"; done && cd - | |
- name: lists artifacts | |
run: | | |
ls -l ${{ env.ARTIFACTS_DIR }} | |
- name: publish binaries to github | |
if: startswith(github.ref, 'refs/tags/v') | |
run: | | |
sudo npm install --silent --no-progress -g github-release-cli@1.3.1 | |
# Parse repository to get owner and repo names | |
OWNER_NAME="${GITHUB_REPOSITORY%%/*}" | |
REPO_NAME="${GITHUB_REPOSITORY#*/}" | |
# Get the list of files | |
RELEASE_ARTIFACT=(${{ env.ARTIFACTS_DIR }}/*) | |
export GITHUB_TOKEN=${{ secrets.DAPR_BOT_TOKEN }} | |
echo "Uploading release packages to GitHub Release" | |
github-release upload \ | |
--owner $OWNER_NAME \ | |
--repo $REPO_NAME \ | |
--body "Release dapr dashboard v${REL_VERSION}" \ | |
--tag "v${REL_VERSION}" \ | |
--name "Dapr dashboard v${REL_VERSION}" \ | |
--prerelease true \ | |
${RELEASE_ARTIFACT[*]} | |
- name: docker login | |
run: | | |
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }} | |
- name: Build and push docker multiarch manifest to Docker Hub | |
if: matrix.target_os != 'darwin' | |
run: | | |
echo "Build docker multiarch image manifest and push it" | |
make docker-publish DAPR_REGISTRY=${{ secrets.DOCKER_DAPRIO_REGISTRY }} DAPR_TAG=${{ env.REL_VERSION }} | |
- name: GitHub container registry login | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push docker multiarch manifest to ghcr | |
if: matrix.target_os != 'darwin' | |
run: | | |
echo "Build docker multiarch image manifest and push it" | |
make docker-publish DAPR_REGISTRY=ghcr.io/${{ github.repository_owner }} DAPR_TAG=${{ env.REL_VERSION }} | |
helm-build: | |
name: Builds Helm chart | |
env: | |
HELM_PACKAGE_DIR: helm | |
HELMVER: v3.7.2 | |
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }} | |
ARTIFACT_DIR: ./helm_release | |
DAPR_VERSION_ARTIFACT: dapr_version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Helm ${{ env.HELMVER }} | |
uses: azure/setup-helm@v1 | |
with: | |
version: ${{ env.HELMVER }} | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Parse release version and set REL_VERSION and LATEST_RELEASE | |
run: python ./.github/scripts/get_release_version.py ${{ github.event_name }} | |
- name: Set REPO_OWNER | |
shell: bash | |
run: | | |
REPO_OWNER=${{ github.repository_owner }} | |
# Lowercase the value | |
echo "REPO_OWNER=${REPO_OWNER,,}" >>${GITHUB_ENV} | |
- name: Update Helm chart files for release version ${{ env.REL_VERSION }} | |
run: ./.github/scripts/set_helm_dapr_version.sh | |
- name: Generate Helm chart manifest | |
if: env.DOCKER_REGISTRY != '' | |
env: | |
DAPR_REGISTRY: ${{ env.DOCKER_REGISTRY }} | |
DAPR_TAG: ${{ env.REL_VERSION }} | |
run: | | |
make manifest-gen | |
shell: bash | |
- name: Move Helm chart manifest to artifact | |
if: env.DOCKER_REGISTRY != '' | |
run: | | |
mkdir -p ${{ env.ARTIFACT_DIR }} | |
mv ./release/install/dapr-dashboard.yaml ${{ env.ARTIFACT_DIR }}/dapr-dashboard.yaml | |
- name: Save release version | |
run: | | |
mkdir -p ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }} | |
echo ${REL_VERSION} > ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }}/${{ env.DAPR_VERSION_ARTIFACT }} | |
- name: Package Helm chart | |
if: ${{ env.LATEST_RELEASE }} == "true" && env.DOCKER_REGISTRY != '' | |
env: | |
HELM_CHARTS_DIR: chart/dapr-dashboard | |
run: | | |
mkdir -p ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }} | |
helm package ${{ env.HELM_CHARTS_DIR }} --destination ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }} | |
- name: Upload Helm charts package to artifacts | |
if: ${{ env.LATEST_RELEASE }} == "true" && env.DOCKER_REGISTRY != '' | |
uses: actions/upload-artifact@master | |
with: | |
name: dapr_helm_charts_package | |
path: ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }} | |
# This job downloads the helm charts package artifact uploaded by the publish job, | |
# checks out the helm charts git hub pages repo and commits the latest version of | |
# helm charts package. | |
# This does not run on forks | |
helm-publish: | |
name: Publish Helm charts to Helm github pages repo | |
needs: helm-build | |
if: startswith(github.ref, 'refs/tags/v') && github.repository_owner == 'dapr' | |
env: | |
ARTIFACT_DIR: ./helm_release | |
DAPR_VERSION_ARTIFACT: dapr_version | |
HELM_PACKAGE_DIR: helm | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create Helm charts directory | |
run: | | |
mkdir -p ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }} | |
- name: download artifacts - dapr_helm_charts_package | |
uses: actions/download-artifact@master | |
with: | |
name: dapr_helm_charts_package | |
path: ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }} | |
- name: Checkout Helm Charts Repo | |
uses: actions/checkout@v3 | |
env: | |
DAPR_HELM_REPO: dapr/helm-charts | |
DAPR_HELM_REPO_CODE_PATH: helm-charts | |
with: | |
repository: ${{ env.DAPR_HELM_REPO }} | |
ref: refs/heads/master | |
token: ${{ secrets.DAPR_BOT_TOKEN }} | |
path: ${{ env.DAPR_HELM_REPO_CODE_PATH }} | |
- name: Upload helm charts to Helm Repo | |
env: | |
DAPR_HELM_REPO_CODE_PATH: helm-charts | |
DAPR_HELM_REPO: https://dapr.github.io/helm-charts/ | |
run: | | |
daprVersion=`cat ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }}/${{ env.DAPR_VERSION_ARTIFACT }}` | |
cd ${{ env.ARTIFACT_DIR }}/${{ env.HELM_PACKAGE_DIR }} | |
cp -r `ls -A | grep -v ${{ env.DAPR_VERSION_ARTIFACT }}` $GITHUB_WORKSPACE/${{ env.DAPR_HELM_REPO_CODE_PATH }} | |
cd $GITHUB_WORKSPACE/${{ env.DAPR_HELM_REPO_CODE_PATH }} | |
helm repo index --url ${{ env.DAPR_HELM_REPO }} --merge index.yaml . | |
git config --global user.email "daprweb@microsoft.com" | |
git config --global user.name "dapr-bot" | |
git add --all | |
# Check if the dapr-dashboard-${daprVersion}.tgz file is modified. | |
if git diff --name-only --staged | grep -q ${daprVersion}; then | |
# If it is, we update the Helm chart, since this is an intentional update. | |
git commit -m "Release - $daprVersion" | |
git push | |
else | |
# This check is here because the automation can fail, but the manual step is no longer required. | |
# If not, this update was accidentally triggered by tagging a release before updating the Helm chart. | |
echo "::error::There is no change for ${daprVersion} Helm chart. Did you forget to update the chart version before tagging?" | |
exit -1 | |
fi |