Skip to content

Commit 82be6c7

Browse files
authored
Merge branch 'main' into tests
2 parents 82bfad0 + 56608d4 commit 82be6c7

3 files changed

Lines changed: 61 additions & 21 deletions

File tree

‎.github/workflows/bump.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,15 @@ jobs:
2929
version=$(echo "$props" | grep -oPm1 "(?<=<Version>)[^<]*")
3030
echo "version=$version" >> $GITHUB_OUTPUT
3131
32-
- name: Validate new version
32+
- name: Validate new version (format)
33+
# Use regex to make sure the version is 1.2.3 or 1.2.3-ci-abcdef0
34+
run: |
35+
if ! [[ "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z].*)?$ ]]; then
36+
echo "Invalid version: ${{ inputs.version }}"
37+
exit 1
38+
fi
39+
40+
- name: Validate new version (increment)
3341
run: >
3442
npx semver@7.5.4 "${{ inputs.version }}"
3543
--range "> ${{ steps.current-version.outputs.version }}"

‎.github/workflows/main.yml‎

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,34 @@ env:
3838
# steps to more sensitive access scopes.
3939

4040
jobs:
41+
# Determine version
42+
version:
43+
runs-on: ubuntu-latest
44+
permissions:
45+
contents: read
46+
47+
steps:
48+
- name: Determine stable version
49+
id: stable-version
50+
if: ${{ github.event_name == 'release' }}
51+
run: |
52+
if ! [[ "${{ github.event.release.tag_name }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z].*)?$ ]]; then
53+
echo "Invalid version: ${{ github.event.release.tag_name }}"
54+
exit 1
55+
fi
56+
57+
echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
58+
59+
- name: Determine prerelease version
60+
id: pre-version
61+
if: ${{ github.event_name != 'release' }}
62+
run: |
63+
hash="${{ github.event.pull_request.head.sha || github.sha }}"
64+
echo "version=0.0.0-ci-${hash:0:7}" >> $GITHUB_OUTPUT
65+
66+
outputs:
67+
version: ${{ steps.stable-version.outputs.version || steps.pre-version.outputs.version }}
68+
4169
# Check formatting
4270
format:
4371
runs-on: ubuntu-latest
@@ -98,6 +126,7 @@ jobs:
98126
99127
# Pack the output into NuGet packages
100128
pack:
129+
needs: version
101130
runs-on: ubuntu-latest
102131
permissions:
103132
actions: write
@@ -120,29 +149,14 @@ jobs:
120149
--configuration Release
121150
-p:ContinuousIntegrationBuild=true
122151
123-
# When triggered by `push` or `pull_request` events, generate a prerelease version
124-
# for the packages, so as to clearly indicate that it's not a stable version release.
125-
- name: Generate prerelease version
126-
id: prerelease-version
127-
if: ${{ github.event_name != 'release' }}
128-
run: |
129-
time=$(date +%s)
130-
ref="${{ github.head_ref || github.ref_name }}"
131-
132-
ref_clean=$ref
133-
ref_clean="${ref_clean/\//-}"
134-
ref_clean="${ref_clean/_/-}"
135-
136-
echo "version=0.0.0-ci-$time-$ref_clean" >> $GITHUB_OUTPUT
137-
138-
- name: Create packages
152+
- name: Run pack
139153
run: >
140154
dotnet pack
155+
-p:Version=${{ needs.version.outputs.version }}
156+
-p:ContinuousIntegrationBuild=true
141157
--no-restore
142158
--no-build
143159
--configuration Release
144-
-p:ContinuousIntegrationBuild=true
145-
${{ steps.prerelease-version.outputs.version && format('-p:Version={0}', steps.prerelease-version.outputs.version) || '' }}
146160
147161
- name: Upload artifacts
148162
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
@@ -192,7 +206,10 @@ jobs:
192206
# Notify the Slack channel about the release
193207
notify:
194208
if: ${{ github.event_name == 'release' }}
195-
needs: deploy
209+
needs:
210+
- version
211+
- deploy
212+
196213
runs-on: ubuntu-latest
197214

198215
steps:
@@ -205,5 +222,5 @@ jobs:
205222
Content-Type: application/json; charset=UTF-8
206223
body: |
207224
{
208-
"text": "*Passwordless-dotnet* version `${{ github.event.release.name }}` has been released! 🎉\nDetails: ${{ github.event.release.html_url }}"
225+
"text": "*Passwordless-dotnet* version `${{ needs.version.outputs.version }}` has been released! 🎉\nDetails: ${{ github.event.release.html_url }}"
209226
}

‎src/Passwordless/Models/Credential.cs‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,19 @@ public Credential(CredentialDescriptor descriptor, byte[] publicKey, byte[] user
101101
/// Identifier for the user
102102
/// </summary>
103103
public string UserId { get; }
104+
105+
/// <summary>
106+
/// Whether the credential is synced (or backed up or not).
107+
/// </summary>
108+
public bool? BackupState { get; set; }
109+
110+
/// <summary>
111+
/// Whether the credential is eligible for backup or syncing
112+
/// </summary>
113+
public bool? IsBackupEligible { get; set; }
114+
115+
/// <summary>
116+
/// Whether the credential is discoverable
117+
/// </summary>
118+
public bool? IsDiscoverable { get; set; }
104119
}

0 commit comments

Comments
 (0)