fix(deps): bump actions/cache from 3 to 4 #138
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
# SPDX-FileCopyrightText: © Vegard IT GmbH (https://vegardit.com) and contributors | |
# SPDX-FileContributor: Sebastian Thomschke, Vegard IT GmbH | |
# SPDX-License-Identifier: Apache-2.0 | |
# | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
name: Build | |
on: | |
push: | |
branches: # build all branches | |
- '**' | |
tags-ignore: # but don't build tags | |
- '**' | |
paths-ignore: | |
- '**/*.adoc' | |
- '**/*.md' | |
- '.editorconfig' | |
- '.git*' | |
- '.github/*.yml' | |
- 'tool' | |
pull_request: | |
workflow_dispatch: | |
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/ | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ${{ matrix.OS }} | |
strategy: | |
fail-fast: false | |
matrix: | |
DART_VERSION: | |
# https://dart.dev/get-dart/archive | |
- stable | |
- 3.1.1 | |
- 3.0.0 | |
OS: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
steps: | |
- name: Init | |
id: init | |
run: | | |
if [[ "${{ matrix.DART_VERSION }}" == "stable" && "${{ matrix.OS }}" == "ubuntu-latest" && $GITHUB_REF_NAME == "main" ]]; then | |
echo "MAY_CREATE_RELEASE=true" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Git Checkout | |
if: ${{ steps.init.outputs.MAY_CREATE_RELEASE != 'true' }} | |
uses: actions/checkout@v4 #https://github.com/actions/checkout | |
# Publishing Dart packages automatically requires to run a workflow on a newly created tag https://dart.dev/tools/pub/automated-publishing | |
# However creating a tag in a workflow using the GITHUB_TOKEN, a token of a GitHub App or a personal access token does | |
# not trigger the second workflow. It only works when creating the tag with a deploy key. See also: | |
# https://github.com/orgs/community/discussions/27028 | |
# https://github.com/orgs/community/discussions/27194 | |
- name: Git Checkout | |
if: ${{ steps.init.outputs.MAY_CREATE_RELEASE == 'true' }} | |
uses: actions/checkout@v4 #https://github.com/actions/checkout | |
with: | |
ssh-key: ${{ secrets.DART_PUB_DEPLOY_KEY }} | |
- uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: ${{ matrix.DART_VERSION }} | |
- name: Cache Dart Pub | |
uses: actions/cache@v4 | |
with: | |
path: ~/.pub-cache | |
key: ${{ runner.os }}-dartpub-${{ hashFiles('**/pubspec.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-dartpub- | |
- name: Build | |
run: | | |
# set MAY_CREATE_RELEASE variable used by build.sh | |
if [[ "${{ steps.init.outputs.MAY_CREATE_RELEASE }}" == "true" ]]; then | |
export MAY_CREATE_RELEASE=true | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
else | |
export MAY_CREATE_RELEASE=false | |
fi | |
bash .ci/build.sh |