|
1 | | -# When a new Release is created, deploy relevant |
| 1 | +# When a new release is created, deploy relevant |
2 | 2 | # files to each of the generated repos. |
3 | | -name: Deploy Framework |
| 3 | +name: Deploy Distributable Repos |
4 | 4 |
|
5 | 5 | on: |
6 | 6 | release: |
7 | 7 | types: [published] |
8 | 8 |
|
9 | 9 | jobs: |
| 10 | + check-version: |
| 11 | + name: Check for updated version |
| 12 | + runs-on: ubuntu-22.04 |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v3 |
| 17 | + with: |
| 18 | + fetch-depth: 0 # fetch all tags |
| 19 | + |
| 20 | + - name: Get latest version |
| 21 | + run: | |
| 22 | + echo 'LATEST_VERSION<<EOF' >> $GITHUB_ENV |
| 23 | + echo $(git describe --tags --abbrev=0) | sed "s/v//" >> $GITHUB_ENV |
| 24 | + echo 'EOF' >> $GITHUB_ENV |
| 25 | +
|
| 26 | + - name: Search for updated version |
| 27 | + if: ${{ env.LATEST_VERSION }} |
| 28 | + run: | |
| 29 | + chmod +x ${GITHUB_WORKSPACE}/.github/scripts/validate-version |
| 30 | + ${GITHUB_WORKSPACE}/.github/scripts/validate-version ${{ env.LATEST_VERSION }} |
| 31 | +
|
10 | 32 | framework: |
11 | 33 | name: Deploy to framework |
12 | 34 | if: github.repository == 'codeigniter4/CodeIgniter4' |
13 | | - runs-on: ubuntu-latest |
| 35 | + runs-on: ubuntu-22.04 |
| 36 | + needs: check-version |
| 37 | + |
14 | 38 | steps: |
15 | 39 | - name: Identify |
16 | 40 | run: | |
|
55 | 79 | appstarter: |
56 | 80 | name: Deploy to appstarter |
57 | 81 | if: github.repository == 'codeigniter4/CodeIgniter4' |
58 | | - runs-on: ubuntu-latest |
| 82 | + runs-on: ubuntu-22.04 |
| 83 | + needs: check-version |
| 84 | + |
59 | 85 | steps: |
60 | 86 | - name: Identify |
61 | 87 | run: | |
@@ -96,3 +122,56 @@ jobs: |
96 | 122 | name: release.data.name, |
97 | 123 | body: release.data.body |
98 | 124 | }) |
| 125 | +
|
| 126 | + userguide: |
| 127 | + name: Deploy to userguide |
| 128 | + if: github.repository == 'codeigniter4/CodeIgniter4' |
| 129 | + runs-on: ubuntu-22.04 |
| 130 | + needs: check-version |
| 131 | + |
| 132 | + steps: |
| 133 | + - name: Identify |
| 134 | + run: | |
| 135 | + git config --global user.email "[email protected]" |
| 136 | + git config --global user.name "${GITHUB_ACTOR}" |
| 137 | +
|
| 138 | + - name: Checkout source |
| 139 | + uses: actions/checkout@v3 |
| 140 | + with: |
| 141 | + path: source |
| 142 | + |
| 143 | + - name: Checkout target |
| 144 | + uses: actions/checkout@v3 |
| 145 | + with: |
| 146 | + repository: codeigniter4/userguide |
| 147 | + token: ${{ secrets.ACCESS_TOKEN }} |
| 148 | + path: userguide |
| 149 | + |
| 150 | + - name: Install Sphinx |
| 151 | + run: | |
| 152 | + sudo apt install python3-sphinx |
| 153 | + sudo pip3 install sphinxcontrib-phpdomain |
| 154 | + sudo pip3 install sphinx_rtd_theme |
| 155 | +
|
| 156 | + - name: Chmod |
| 157 | + run: chmod +x ./source/.github/scripts/deploy-userguide |
| 158 | + |
| 159 | + - name: Deploy |
| 160 | + run: ./source/.github/scripts/deploy-userguide ${GITHUB_WORKSPACE}/source ${GITHUB_WORKSPACE}/userguide ${GITHUB_REF##*/} |
| 161 | + |
| 162 | + - name: Release |
| 163 | + uses: actions/github-script@v6 |
| 164 | + with: |
| 165 | + github-token: ${{secrets.ACCESS_TOKEN}} |
| 166 | + script: | |
| 167 | + const release = await github.rest.repos.getLatestRelease({ |
| 168 | + owner: context.repo.owner, |
| 169 | + repo: context.repo.repo |
| 170 | + }) |
| 171 | + github.rest.repos.createRelease({ |
| 172 | + owner: context.repo.owner, |
| 173 | + repo: 'userguide', |
| 174 | + tag_name: release.data.tag_name, |
| 175 | + name: release.data.name, |
| 176 | + body: release.data.body |
| 177 | + }) |
0 commit comments