56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
name: Heroku deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
name: Deploy to Heroku
|
|
|
|
environment: heroku
|
|
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Get version
|
|
id: version
|
|
run: |
|
|
echo "version=$(git describe --abbrev=0 --tags | sed 's/^v//')" >> $GITHUB_OUTPUT
|
|
echo "release=$(git describe --abbrev=0 --tags --exact-match $GITHUB_SHA 2>/dev/null || git log --pretty="%h" -n1 $GITHUB_SHA)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config user.email $GIT_EMAIL
|
|
git config user.name $GIT_USERNAME
|
|
env:
|
|
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
|
|
GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
|
|
|
|
- name: Create release files
|
|
run: |
|
|
echo ${{ steps.version.outputs.version }} > config/.version
|
|
echo ${{ steps.version.outputs.release }} > config/.release
|
|
echo $GITHUB_SHA > config/.commit
|
|
|
|
- name: Update .htaccess
|
|
run: cp -f scripts/.htaccess_production public/.htaccess
|
|
|
|
- name: Commit everything
|
|
run: |
|
|
git add -A --force public config
|
|
git commit -m "Build $($CURRENT_DATE_TIME)"
|
|
env:
|
|
CURRENT_DATE_TIME: "date +%Y-%m-%d:%H-%M"
|
|
|
|
- name: Deploy to Heroku
|
|
uses: akhileshns/heroku-deploy@v3.12.12
|
|
with:
|
|
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
|
|
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}
|
|
heroku_email: ${{ secrets.HEROKU_EMAIL }}
|