Skip to content

Commit f30babb

Browse files
committed
Sync with microG unofficial installer
1 parent 668358a commit f30babb

4 files changed

Lines changed: 69 additions & 20 deletions

File tree

.github/workflows/auto-nightly.yml

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ on:
1414
concurrency:
1515
group: "${{ github.repository_id }}-${{ github.workflow }}"
1616
cancel-in-progress: true
17-
env:
18-
GITHUB_REPOSITORY_DEFAULT_BRANCH: "${{ github.event.repository.default_branch }}"
1917

2018
jobs:
2119
nightly:
2220
name: "Nightly"
2321
runs-on: ubuntu-latest
2422
if: "${{ github.event_name == 'push' && github.ref_type == 'branch' }}"
2523
permissions:
26-
contents: write # Needed to create a tag
24+
contents: write # Needed to delete a release and to modify a tag
25+
id-token: write # Needed to attest build provenance
26+
attestations: write # Needed to attest build provenance
27+
env:
28+
GITHUB_REPOSITORY_DEFAULT_BRANCH: "${{ github.event.repository.default_branch }}"
2729

2830
steps:
2931
- name: "Checkout sources"
@@ -40,12 +42,19 @@ jobs:
4042
restore-keys: "build-"
4143
path: "cache/build"
4244
enableCrossOsArchive: true
43-
- name: "Build nightly"
45+
- name: "Build the flashable OTA zip"
4446
id: "build"
4547
shell: bash
4648
run: |
47-
# Building nightly...
49+
# Building...
4850
BUILD_TYPE='oss' '${{ github.workspace }}/build.sh'
51+
- name: "Attest build provenance"
52+
id: "attest"
53+
uses: actions/attest-build-provenance@v2
54+
if: "${{ vars.NIGHTLY_ATTESTATION == 'true' && github.run_attempt == '1' && steps.build.outputs.ZIP_BUILD_TYPE_SUPPORTED == 'true' }}"
55+
with:
56+
subject-path: "${{ steps.build.outputs.ZIP_FOLDER }}/*.zip"
57+
show-summary: false
4958
- name: "ZIP info"
5059
run: |
5160
# Retrieve informations...
@@ -58,6 +67,7 @@ jobs:
5867
ZIP_IS_ALPHA='${{ steps.build.outputs.ZIP_IS_ALPHA }}'
5968
ZIP_SHA256='${{ steps.build.outputs.ZIP_SHA256 }}'
6069
ZIP_MD5='${{ steps.build.outputs.ZIP_MD5 }}'
70+
ZIP_ATTESTATION='${{ steps.attest.outputs.attestation-url }}'
6171
# Displaying informations...
6272
printf '%s\n' "::notice::Filename: ${ZIP_FILENAME:-Missing}"
6373
printf '%s\n' "::notice::Version: ${ZIP_VERSION:-Missing}"
@@ -67,6 +77,7 @@ jobs:
6777
printf '%s\n' "::notice::Is alpha: ${ZIP_IS_ALPHA:-Missing}"
6878
printf '%s\n' "::notice::SHA-256: ${ZIP_SHA256:-Missing}"
6979
printf '%s\n' "::notice::MD5: ${ZIP_MD5:-Missing}"
80+
printf '%s\n' "::notice::Attestation: ${ZIP_ATTESTATION:-Missing}"
7081
: "${ZIP_FOLDER:?}" || exit "${?}"
7182
- name: "Do we need to publish the nightly build?"
7283
id: "nightly-logic"
@@ -122,13 +133,15 @@ jobs:
122133
name: "${{ steps.build.outputs.ZIP_VERSION }} nightly"
123134
tag_name: "nightly"
124135
target_commitish: "${{ github.sha }}"
125-
body: "Latest automatically built ZIP (unstable development snapshot)\n\nSHA-256: ${{ steps.build.outputs.ZIP_SHA256 }}"
136+
body: "Latest automatically built ZIP (unstable development snapshot).\nAttestation: ${{ steps.attest.outputs.attestation-url }}\n\nSHA-256: ${{ steps.build.outputs.ZIP_SHA256 }}"
126137
append_body: false
127138
generate_release_notes: false
128139
make_latest: false
129140
draft: false
130141
prerelease: true
131-
files: "${{ steps.build.outputs.ZIP_FOLDER }}/*.zip*"
142+
files: |
143+
${{ steps.build.outputs.ZIP_FOLDER }}/*.zip*
144+
${{ steps.attest.outputs.bundle-path }}
132145
fail_on_unmatched_files: true
133146
- name: "Upload artifacts"
134147
uses: actions/upload-artifact@v4
@@ -140,13 +153,15 @@ jobs:
140153
retention-days: 10
141154
compression-level: 0
142155

143-
keep-cache:
144-
name: "Keep cache alive"
156+
keep-alive:
157+
name: "Keep alive"
145158
runs-on: ubuntu-latest
146159
if: "${{ github.event_name == 'schedule' }}"
160+
permissions:
161+
actions: write # Needed to keep alive the workflow
147162

148163
steps:
149-
- name: "Checkout sources"
164+
- name: "Checkout file"
150165
uses: actions/checkout@v4
151166
with:
152167
sparse-checkout: |
@@ -159,3 +174,24 @@ jobs:
159174
path: "cache/build"
160175
enableCrossOsArchive: true
161176
lookup-only: true
177+
- name: "Keep workflow alive"
178+
uses: actions/github-script@v7
179+
env:
180+
WORKFLOW_REF: "${{ github.workflow_ref }}"
181+
with:
182+
retries: 3
183+
script: |
184+
/* jshint esversion: 6 */
185+
const workflow_filename = process.env.WORKFLOW_REF.split('@', 1)[0].split('/').slice(2).join('/');
186+
const response = await github.rest.actions.enableWorkflow({
187+
owner: context.repo.owner,
188+
repo: context.repo.repo,
189+
workflow_id: workflow_filename
190+
}).catch(response => response);
191+
if(response && response.status === 204) {
192+
// OK
193+
} else {
194+
let errorMsg = 'enableWorkflow failed';
195+
if(response && response.status && response.message) errorMsg += ' with error ' + response.status + ' (' + response.message + ')';
196+
throw new Error(errorMsg);
197+
}

.github/workflows/coverage.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ jobs:
4141
#sudo apt-get -qq -y install moreutils 1>/dev/null
4242
bashcov '${{ github.workspace }}/build.sh' # To timestamp the output pipe it to: TZ=UTC ts '[%H:%M:%S]'
4343
- name: "Testing (with coverage)"
44-
if: "${{ steps.build.outputs.ZIP_BUILD_TYPE_SUPPORTED == 'true' }}"
4544
shell: bash
45+
if: "${{ steps.build.outputs.ZIP_BUILD_TYPE_SUPPORTED == 'true' }}"
4646
run: |
4747
# Testing of zip installation...
4848
echo '==========================='
@@ -64,18 +64,31 @@ jobs:
6464
cat '${{ github.workspace }}/recovery-simulator/output/installed-files.log'
6565
fi
6666
- name: "Verify Codecov token"
67+
id: "codecov-token"
6768
shell: bash
69+
if: "${{ steps.build.outputs.ZIP_BUILD_TYPE_SUPPORTED == 'true' }}"
6870
run: |
6971
# Verifying token...
70-
test -n '${{ secrets.CODECOV_TOKEN }}' || exit 3
72+
token_set='true'
73+
test -n '${{ secrets.CODECOV_TOKEN }}' || token_set='false'
74+
printf 'TOKEN_SET=%s\n' "${token_set:?}" 1>> "${GITHUB_OUTPUT?}"
7175
- name: "Upload coverage reports to Codecov"
72-
if: "${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.repository_owner == 'micro5k' }}"
76+
if: "${{ steps.codecov-token.outputs.TOKEN_SET == 'true' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}"
7377
uses: codecov/codecov-action@v5
7478
with:
7579
fail_ci_if_error: true
7680
token: "${{ secrets.CODECOV_TOKEN }}"
81+
- name: "Verify Codacy token"
82+
id: "codacy-token"
83+
shell: bash
84+
if: "${{ steps.build.outputs.ZIP_BUILD_TYPE_SUPPORTED == 'true' }}"
85+
run: |
86+
# Verifying token...
87+
token_set='true'
88+
test -n '${{ secrets.CODACY_PROJECT_TOKEN }}' || token_set='false'
89+
printf 'TOKEN_SET=%s\n' "${token_set:?}" 1>> "${GITHUB_OUTPUT?}"
7790
- name: "Upload coverage reports to Codacy"
78-
if: "${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.repository_owner == 'micro5k' }}"
91+
if: "${{ steps.codacy-token.outputs.TOKEN_SET == 'true' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}"
7992
uses: codacy/codacy-coverage-reporter-action@v1
8093
with:
8194
project-token: "${{ secrets.CODACY_PROJECT_TOKEN }}"

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ build-job:
4444
artifacts:
4545
paths:
4646
- output/*.zip*
47-
expire_in: 1 hour
47+
expire_in: 30 minutes
4848

4949
# license_scanning:
5050
# stage: test

build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,14 @@ FILENAME_MIDDLE="${FILENAME_COMMIT_ID:?}"
178178
FILENAME_END="-${BUILD_TYPE:?}-by-${MODULE_AUTHOR:?}"
179179

180180
if test "${CI:-false}" != 'false'; then
181+
if test "${CI_PROJECT_NAMESPACE:-${GITHUB_REPOSITORY_OWNER:-unknown}}" != 'micro''5k'; then
182+
FILENAME_MIDDLE="fork-${FILENAME_MIDDLE:?}" # GitLab / GitHub
183+
fi
181184
if test -n "${CI_COMMIT_BRANCH-}" && test "${CI_COMMIT_BRANCH:?}" != "${CI_DEFAULT_BRANCH:-unknown}"; then
182-
FILENAME_MIDDLE="${FILENAME_MIDDLE:?}-[${CI_COMMIT_BRANCH:?}]" # GitLab
185+
FILENAME_MIDDLE="${CI_COMMIT_BRANCH:?}-${FILENAME_MIDDLE:?}" # GitLab
183186
fi
184187
if test "${GITHUB_REF_TYPE-}" = 'branch' && test -n "${GITHUB_REF_NAME-}" && test "${GITHUB_REF_NAME:?}" != "${GITHUB_REPOSITORY_DEFAULT_BRANCH:-main}"; then
185-
FILENAME_MIDDLE="${FILENAME_MIDDLE:?}-[${GITHUB_REF_NAME:?}]" # GitHub
186-
fi
187-
if test "${CI_PROJECT_NAMESPACE:-${GITHUB_REPOSITORY_OWNER:-unknown}}" != 'micro''5k'; then
188-
FILENAME_MIDDLE="${FILENAME_MIDDLE:?}-[fork]" # GitLab / GitHub
188+
FILENAME_MIDDLE="${GITHUB_REF_NAME:?}-${FILENAME_MIDDLE:?}" # GitHub
189189
fi
190190
fi
191191

0 commit comments

Comments
 (0)