CI/CD #9285
This file contains 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
name: CI/CD | |
on: | |
push: | |
branches: | |
- 'dev' | |
schedule: | |
- cron: '0 * * * *' | |
jobs: | |
build_and_deploy: | |
strategy: | |
matrix: | |
os: ['ubuntu-latest'] | |
perl: [ '5.38', '5.36' ] | |
name: Perl ${{ matrix.perl }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Perl | |
uses: shogo82148/actions-setup-perl@v1 | |
with: | |
perl-version: ${{ matrix.perl }} | |
- name: Install Dependencies | |
run: | | |
cpm install | |
- name: Clone Source Data Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
repository: zengin-code/source-data | |
sparse-checkout: data | |
sparse-checkout-cone-mode: false | |
path: share | |
- name: GitHub Actionsの環境変数にデータ更新日を設定する | |
run: | | |
echo "UPDATED_AT=$(cat share/data/updated_at)" >> $GITHUB_ENV | |
- name: lib/Zengin/Perl.pm のバージョン番号書き換え | |
run: | | |
perl -wpi -E'/^our/ and /(\d{8})/ and s/$1/$ENV{UPDATED_AT}/e' lib/Zengin/Perl.pm | |
- name: Run Tests | |
run: | | |
git add -A | |
prove -lv t | |
git reset HEAD | |
- name: Checkout master branch | |
run: | | |
git fetch | |
git checkout master | |
git pull origin master | |
- name: Show current branch | |
run: git branch | |
- name: Show last commit | |
run: git log -1 | |
- name: Commit and Push Changes | |
run: | | |
git config core.filemode false | |
if ! git diff --exit-code --quiet; then | |
git add -A | |
git config user.name github-actions | |
git config user.email [email protected] | |
git commit -m "Commit updated files" | |
git push origin master | |
else | |
echo "No changes to commit" | |
fi |