Merge pull request #143 from vilniusphp/feature/vilniusphp-0x91 #81
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: "Deploy to https://vilniusphp.lt" | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Fail if not using GitHub Repsitory secrets | |
env: | |
WHO_TO_TRUST: ${{ secrets.SECURED }} | |
if: env.WHO_TO_TRUST != 'true' | |
run: echo "Repository secrets are not configured correctly" && exit 1 | |
- name: Download PHP docker container | |
run: docker pull php:5.6 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Build HTML (along with same PHP Extension fixes) | |
run: docker run -v $(pwd):/code -w /code -e TZ='UTC' php:5.6 bash -c "echo 'date.timezone=Europe/Vilnius' > /usr/local/etc/php/conf.d/timezone.ini && apt-get update && apt-get install -y libzip-dev procps g++ libcurl4-gnutls-dev git wget gzip unzip && docker-php-ext-install zip && make" | |
- name: Sanitise before storing artifacts | |
run: rm -Rf public_html/.git | |
if: always() | |
- name: Store generated HTML | |
uses: actions/upload-artifact@v1 | |
if: always() | |
with: | |
name: html | |
path: public_html | |
- env: | |
GITHUB_USERNAME: ${{ secrets.USERNAME }} | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
run: | | |
git config --global user.name "Aurelijaus Bot'as" | |
git config --global user.email "[email protected]" | |
git clone https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/vilniusphp/vilniusphp.github.io.git | |
- run: cp -a public_html/. vilniusphp.github.io | |
- name: Store changelog, to not fail on no changes | |
run: git log --pretty=oneline | head -n 10 > vilniusphp.github.io/changelog.txt | |
- run: | | |
cd vilniusphp.github.io | |
git add . --all | |
git commit -m "Build new website version" | |
git push origin master |