Skip to content

Commit 0a7ea6e

Browse files
committed
Improved build-upstream-mirror workflow with variables and default values
1 parent 6ed405c commit 0a7ea6e

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,51 @@
11
name: Build, deploy & check Mirror
2+
env:
3+
PREVIEW_REPO: 'https://preview-mirror.mage-os.org/'
4+
PROD_REPO: 'https://mirror.mage-os.org/'
5+
PREVIEW_REMOTE_DIR: '/var/www/preview-mirror.mage-os.org/html/'
6+
PROD_REMOTE_DIR: '/var/www/mirror.mage-os.org/html/'
27

38
on:
49
workflow_dispatch:
510
inputs:
611
repo:
712
description: 'The composer repository url'
813
required: true
9-
default: 'https://preview-mirror.mage-os.org/'
14+
default: ${{ env.PREVIEW_REPO }}
1015
type: choice
1116
options:
12-
- https://preview-mirror.mage-os.org/
13-
- https://mirror.mage-os.org/
17+
- ${{ env.PREVIEW_REPO }}
18+
- ${{ env.PROD_REPO }}
1419
remote_dir:
1520
description: 'The deploy target directory on the repo host'
1621
required: true
17-
default: '/var/www/preview-mirror.mage-os.org/html/'
22+
default: ${{ env.PREVIEW_REMOTE_DIR }}
1823
type: choice
1924
options:
20-
- /var/www/preview-mirror.mage-os.org/html/
21-
- /var/www/mirror.mage-os.org/html/
25+
- ${{ env.PREVIEW_REMOTE_DIR }}
26+
- ${{ env.PROD_REMOTE_DIR }}
2227
push:
2328
branches:
24-
- main
29+
- main
2530

2631
jobs:
2732
deploy:
2833
uses: ./.github/workflows/deploy.yml
2934
name: "generate & deploy"
3035
if: contains('["vinai", "rhoerr", "fballiano", "mage-os-ci"]', github.actor)
3136
with:
32-
repo: ${{ inputs.repo }}
33-
remote_dir: ${{ inputs.remote_dir }}
37+
repo: ${{ (github.event_name == 'workflow_dispatch' && inputs.repo) || env.PREVIEW_REPO }}
38+
remote_dir: ${{ (github.event_name == 'workflow_dispatch' && inputs.remote_dir) || env.PREVIEW_REMOTE_DIR }}
3439
entrypoint: src/make/mirror.js
3540
delete: true
3641
secrets:
3742
SERVER_SSH_KEY: ${{ secrets.SERVER_SSH_KEY }}
3843
REMOTE_USER: ${{ secrets.REMOTE_USER }}
44+
3945
integrity-check:
4046
needs: [deploy]
4147
uses: ./.github/workflows/integrity-check.yml
4248
with:
43-
repo: ${{ inputs.repo }}
49+
repo: ${{ (github.event_name == 'workflow_dispatch' && inputs.repo) || env.PREVIEW_REPO }}
4450
secrets:
4551
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

0 commit comments

Comments
 (0)