forked from zingolabs/zingo-mobile
-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (38 loc) · 1.5 KB
/
create-cache-key.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Create cache key
on:
workflow_call:
outputs:
cache-key:
description: "Cache key"
value: ${{ jobs.create-cache-key.outputs.cache-key }}
env:
REPO-OWNER: ${{ github.repository_owner }}
jobs:
create-cache-key:
name: Create cache key
runs-on: macos-13
env:
RUSTUP_HOME: /root/.rustup
outputs:
cache-key: ${{ steps.create-cache-key.outputs.cache-key }}
steps:
- name: Set envs for zingolib CI
if: ${{ contains(github.repository, 'zingolib') }}
run: echo "REPO-OWNER=zingolabs" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ env.REPO-OWNER }}/zingo-mobile
- name: Cargo update for zingolib CI
if: ${{ contains(github.repository, 'zingolib') }}
run: |
echo "zingolib_ref=$(echo ${GITHUB_REF} | sed 's/\//\\\//g')" >> $GITHUB_ENV
sudo sed -i '' "/^zingolib/ s/branch = \"dev\"/rev = \"${{ env.zingolib_ref }}\"/" "rust/lib/Cargo.toml"
if cat rust/lib/Cargo.toml | grep "^zingolib" | grep -q "branch"; then exit 1; fi
cd rust
sudo cargo update -p zingolib --aggressive
- name: Store Cargo version
run: echo $(cargo --version) >> rust/cargo_version.txt
- name: Create cache key
id: create-cache-key
run: echo "cache-key=${{ hashFiles('rust/**/Cargo.toml', 'rust/**/Cargo.lock', 'rust/**/*.rs', 'rust/cargo_version.txt') }}" >> $GITHUB_OUTPUT