Skip to content

Commit 19641d3

Browse files
flat-manager: main function can't be async & document new inputs
1 parent a327759 commit 19641d3

File tree

2 files changed

+48
-33
lines changed

2 files changed

+48
-33
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Build and deploy your Flatpak application using Github Actions
1212

1313
### Building stage
1414

15-
1615
Add a new workflow by creating a `.yml` file under `.github/workflows` with this content
1716

1817
```yaml
@@ -83,9 +82,21 @@ jobs:
8382
options: --privileged
8483
steps:
8584
- uses: actions/checkout@v2
86-
- uses: bilelmoussaoui/flatpak-github-actions/flat-manager@master
85+
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@master
8786
with:
8887
bundle: "palette.flatpak"
89-
remote-url: "org.gnome.zbrown.Palette.yml"
90-
token: ${{ secrets.FLAT_MANAGER }}
88+
manifest-path: "org.gnome.zbrown.Palette.yml"
89+
- uses: bilelmoussaoui/flatpak-github-actions/flat-manager@master
90+
with:
91+
repository: elementary
92+
flat-manager-url: https://flatpak-api.elementary.io
93+
token: some_very_hidden_token
9194
```
95+
96+
#### Inputs
97+
98+
| Name | Description | Required | Default |
99+
| --- | ----------- | ----------- |----|
100+
| `repository` | The repository to push the build into | Required | - |
101+
| `flat-manager-url` | The flat-manager remote URL | Required | - |
102+
| `token` | A flat-manager token | Required | - |

flat-manager/index.js

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,44 @@ const exec = require("@actions/exec")
55
const LOCAL_REPO_NAME = "repo"
66

77

8-
const run = async (repository, flatManagerUrl, token) => {
9-
await exec.exec('flatpak', [
8+
const run = (repository, flatManagerUrl, token) => {
9+
exec.exec('flatpak', [
1010
'build-update-repo',
1111
'--generate-static-deltas',
1212
LOCAL_REPO_NAME,
1313
])
14-
15-
const buildId = await exec.exec('flat-manager-client', [
16-
'create',
17-
flatManagerUrl,
18-
repository,
19-
'--token',
20-
token
21-
])
22-
23-
exec.exec('flat-manager-client', [
24-
'push',
25-
'--commit',
26-
'--publish',
27-
'--wait',
28-
'--token',
29-
token,
30-
buildId,
31-
LOCAL_REPO_NAME,
32-
]).then(() => {
33-
core.info(`Build published successfully: ${buildId}`)
34-
}).catch((err) => {
35-
core.setFailed(`Failed to commit the build: ${err}`)
14+
.then(async () => {
15+
const buildId = await exec.exec('flat-manager-client', [
16+
'create',
17+
flatManagerUrl,
18+
repository,
19+
'--token',
20+
token
21+
])
22+
return buildId
23+
})
24+
.then(async (buildId) => {
25+
await exec.exec('flat-manager-client', [
26+
'push',
27+
'--commit',
28+
'--publish',
29+
'--wait',
30+
'--token',
31+
token,
32+
buildId,
33+
LOCAL_REPO_NAME,
34+
])
35+
return buildId
36+
})
37+
.then(async (buildId) => {
38+
await exec.exec('flat-manager-client', [
39+
'purge',
40+
buildId,
41+
])
42+
})
43+
.catch((err) => {
44+
core.setFailed(`Failed to publish the build: ${err}`)
3645
})
37-
38-
await exec.exec('flat-manager-client', [
39-
'purge',
40-
buildId,
41-
])
4246
}
4347

4448
if (require.main === module) {

0 commit comments

Comments
 (0)