-
Notifications
You must be signed in to change notification settings - Fork 2k
Add a check for updated version before deployment #6802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/bin/bash | ||
| set -o pipefail | ||
|
|
||
| if [[ -z $1 ]]; then | ||
| echo "validate-version requires a version identifier" | ||
| exit 1 | ||
| fi | ||
|
|
||
| FILES=("system/CodeIgniter.php" "user_guide_src/source/conf.py") | ||
| LENGTH="${#FILES[@]}" | ||
|
|
||
| for FILE in "${FILES[@]}"; do | ||
| COUNT="$((COUNT + $(grep -c "$FILE" -e "$1")))" | ||
| done | ||
|
|
||
| if [[ $COUNT -ne $LENGTH ]]; then | ||
| echo "CodeIgniter version is not updated to v"$1"" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "CodeIgniter version is updated to v"$1"" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,40 @@ | ||
| # When a new Release is created, deploy relevant | ||
| # When a new release is created, deploy relevant | ||
| # files to each of the generated repos. | ||
| name: Deploy Framework | ||
| name: Deploy Distributable Repos | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| check-version: | ||
| name: Check for updated version | ||
| runs-on: ubuntu-22.04 | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 # fetch all tags | ||
|
|
||
| - name: Get latest version | ||
| run: | | ||
| echo 'LATEST_VERSION<<EOF' >> $GITHUB_ENV | ||
| echo $(git describe --tags --abbrev=0) | sed "s/v//" >> $GITHUB_ENV | ||
| echo 'EOF' >> $GITHUB_ENV | ||
|
|
||
| - name: Search for updated version | ||
| if: ${{ env.LATEST_VERSION }} | ||
| run: | | ||
| chmod +x ${GITHUB_WORKSPACE}/.github/scripts/validate-version | ||
| ${GITHUB_WORKSPACE}/.github/scripts/validate-version ${{ env.LATEST_VERSION }} | ||
|
|
||
| framework: | ||
| name: Deploy to framework | ||
| if: github.repository == 'codeigniter4/CodeIgniter4' | ||
| runs-on: ubuntu-latest | ||
| runs-on: ubuntu-22.04 | ||
| needs: check-version | ||
|
|
||
| steps: | ||
| - name: Identify | ||
| run: | | ||
|
|
@@ -55,7 +79,9 @@ jobs: | |
| appstarter: | ||
| name: Deploy to appstarter | ||
| if: github.repository == 'codeigniter4/CodeIgniter4' | ||
| runs-on: ubuntu-latest | ||
| runs-on: ubuntu-22.04 | ||
| needs: check-version | ||
|
|
||
| steps: | ||
| - name: Identify | ||
| run: | | ||
|
|
@@ -96,3 +122,56 @@ jobs: | |
| name: release.data.name, | ||
| body: release.data.body | ||
| }) | ||
|
|
||
| userguide: | ||
| name: Deploy to userguide | ||
| if: github.repository == 'codeigniter4/CodeIgniter4' | ||
| runs-on: ubuntu-22.04 | ||
| needs: check-version | ||
|
|
||
| steps: | ||
| - name: Identify | ||
| run: | | ||
| git config --global user.email "[email protected]" | ||
| git config --global user.name "${GITHUB_ACTOR}" | ||
|
|
||
| - name: Checkout source | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| path: source | ||
|
|
||
| - name: Checkout target | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| repository: codeigniter4/userguide | ||
| token: ${{ secrets.ACCESS_TOKEN }} | ||
| path: userguide | ||
|
|
||
| - name: Install Sphinx | ||
| run: | | ||
| sudo apt install python3-sphinx | ||
| sudo pip3 install sphinxcontrib-phpdomain | ||
| sudo pip3 install sphinx_rtd_theme | ||
|
|
||
| - name: Chmod | ||
| run: chmod +x ./source/.github/scripts/deploy-userguide | ||
|
|
||
| - name: Deploy | ||
| run: ./source/.github/scripts/deploy-userguide ${GITHUB_WORKSPACE}/source ${GITHUB_WORKSPACE}/userguide ${GITHUB_REF##*/} | ||
|
|
||
| - name: Release | ||
| uses: actions/github-script@v6 | ||
| with: | ||
| github-token: ${{secrets.ACCESS_TOKEN}} | ||
| script: | | ||
| const release = await github.rest.repos.getLatestRelease({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo | ||
| }) | ||
| github.rest.repos.createRelease({ | ||
| owner: context.repo.owner, | ||
| repo: 'userguide', | ||
| tag_name: release.data.tag_name, | ||
| name: release.data.name, | ||
| body: release.data.body | ||
| }) | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.