Replace http by https (#21) #40
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
## builds the content of https://github.com/alamirault/fftt-api | |
## inspiration from https://github.com/rectorphp/rector-src/blob/main/.github/workflows/build_scoped_rector.yaml | |
name: Build production | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
env: | |
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361 | |
COMPOSER_ROOT_VERSION: "dev-main" | |
BUILD_REPOSITORY_NAME: "built" | |
jobs: | |
build: | |
name: Downgrade and publish to fftt-api | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Downgrade code for production (to PHP 7.1) | |
run: | | |
composer install | |
bin/rector process | |
- name: Build project for production | |
run: | | |
mkdir $BUILD_REPOSITORY_NAME | |
cp -rT build/target-repository $BUILD_REPOSITORY_NAME | |
cp -R src $BUILD_REPOSITORY_NAME | |
# clone remote repository, so we can push it | |
- | |
uses: "actions/checkout@v3" | |
with: | |
repository: alamirault/fftt-api | |
path: remote-repository | |
token: ${{ secrets.ACCESS_TOKEN_FFTT_API }} | |
- name: Clean git repository and put new built files | |
run: | | |
mv remote-repository/.git .fftt-api-git | |
rm -rf remote-repository/* | |
mv .fftt-api-git remote-repository/.git | |
cp -rT $BUILD_REPOSITORY_NAME remote-repository | |
- name: Setup git author | |
working-directory: remote-repository | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "Antoine Lamirault" | |
- | |
name: "Get Git log" | |
id: git-log | |
run: echo ::set-output name=log::$(git log ${{ github.event.before }}..${{ github.event.after }} --reverse --pretty='%H %s' | sed -e 's/^/https:\/\/github.com\/alamirault\/fftt-api-src\/commit\//') | |
# A publish it to remote repository without tag | |
- | |
name: "Commit Prefixed - main" | |
working-directory: remote-repository | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
run: | | |
git add --all | |
git commit -m "Updated FFTTApi to commit ${{ github.event.after }}" -m "${{ steps.git-log.outputs.log }}" | |
git push --quiet origin main | |
# B publish it to remote repository with tag | |
- | |
name: "Commit Prefixed - tag" | |
working-directory: remote-repository | |
if: "startsWith(github.ref, 'refs/tags/')" | |
run: | | |
git tag ${GITHUB_REF#refs/tags/} -m "${GITHUB_REF#refs/tags/}" | |
git push --quiet origin ${GITHUB_REF#refs/tags/} |