Skip to content
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

Added automatic deployments #85

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#### Link to ticket

Please add a link to the ticket being addressed by this change.

#### Description

Please include a short description of the suggested change and the reasoning behind the approach you have chosen.

#### Screenshot of the result

If your change affects the user interface you should include a screenshot of the result with the pull request.

#### Checklist

- [ ] My code is covered by test cases.
- [ ] My code passes our test (all our tests).
- [ ] My code passes our static analysis suite.
- [ ] My code passes our continuous integration process.

If your code does not pass all the requirements on the checklist you have to add a comment explaining why this change
should be exempt from the list.

#### Additional comments or questions

If you have any further comments or questions for the reviewer please add them here.
54 changes: 54 additions & 0 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
on:
push:
tags:
- '*.*.*'

name: Create Github Release

permissions:
contents: write

jobs:
create-release:
runs-on: ubuntu-latest
env:
COMPOSER_ALLOW_SUPERUSER: 1
APP_ENV: prod
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Composer install
run: |
docker network create frontend
docker compose run --rm --user=root phpfpm composer install --no-dev -o --classmap-authoritative
docker compose run --rm --user=root phpfpm composer clear-cache

- name: Building assets for the frontend
run: |
docker compose run --rm node yarn install
docker compose run --rm node yarn build

- name: Clean up
run: |
sudo chown -R runner:runner ./
rm -rf node_modules

- name: Make assets dir
run: |
mkdir -p ../assets

- name: Create archive
run: |
tar --exclude='.git' -zcf ../assets/${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz ./

- name: Create checksum
run: |
cd ../assets
sha256sum ${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz > ../assets/checksum.txt

- name: Create a release in GitHub and uploads assets
run: gh release create ${{ github.ref_name }} --verify-tag --generate-notes ../assets/*.*
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
shell: bash
35 changes: 32 additions & 3 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ jobs:
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 2

Expand All @@ -26,21 +25,25 @@ jobs:
matrix:
php: ['8.3']
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php }}
extension-csv: ctype, dom, iconv, json
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ matrix.php }}-composer-

- name: Validate composer files
run: composer validate composer.json

Expand All @@ -53,22 +56,27 @@ jobs:
php: ['8.3']
steps:
- uses: actions/checkout@master

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php }}
extension-csv: ctype, dom, iconv, json
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ matrix.php }}-composer-

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist

- name: phpcsfixer
run: composer actions/phpcsfixer

Expand All @@ -81,22 +89,27 @@ jobs:
php: ['8.3']
steps:
- uses: actions/checkout@master

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php }}
extension-csv: ctype, dom, iconv, json
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ matrix.php }}-composer-

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist

- name: twigcs
run: composer actions/twigcs

Expand All @@ -110,9 +123,24 @@ jobs:
node-version: 20
- name: install
run: yarn install

- name: JS coding standards
run: yarn coding-standards-check

markdown:
name: Markdown lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v3
with:
node-version: 20
- name: install
run: yarn install

- name: Run markdown lint
run: yarn run coding-standards-check/markdownlint

test-yarn-build:
name: Test yarn build assets
runs-on: ubuntu-24.04
Expand All @@ -122,6 +150,7 @@ jobs:
- name: Get yarn cache directory
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
Expand Down
24 changes: 24 additions & 0 deletions .woodpecker/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
when:
- event: release

skip_clone: true

steps:
- name: Ansible playbook
image: itkdev/ansible-plugin:1
pull: true
settings:
id:
from_secret: id
secret:
from_secret: secret
host:
from_secret: host
path:
from_secret: path
user:
from_secret: user
playbook: 'release'
pre_up:
- itkdev-docker-compose-server run --rm phpfpm bin/console cache:clear --no-interaction
- itkdev-docker-compose-server run --rm phpfpm bin/console doctrine:migrations:migrate --no-interaction
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.0] - yyyy-mm-dd

[Unreleased]: https://github.com/itk-dev/kunstdatabasen/compare/1.6.8...HEAD
[1.6.8]: https://github.com/itk-dev/kunstdatabasen/compare/1.6.7...1.6.8
[1.7.0]: https://github.com/itk-dev/kunstdatabasen/compare/1.6.8...1.7.0
[1.6.7]: https://github.com/itk-dev/kunstdatabasen/compare/1.6.6...1.6.7
[1.6.6]: https://github.com/itk-dev/kunstdatabasen/compare/1.6.5...1.6.6
[1.6.5]: https://github.com/itk-dev/kunstdatabasen/compare/1.6.4...1.6.5
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.server.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@ services:
environment:
- PHP_MAX_EXECUTION_TIME=60
- PHP_MEMORY_LIMIT=512M
volumes:
- ../../shared/images:/app/public/images
- ../../shared/media:/app/public/media
- ../../shared/.env.local:/app/.env.local

nginx:
volumes:
- ../../shared/images:/app/public/images
- ../../shared/media:/app/public/media
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"coding-standards-check/scss": "yarn run coding-standards-check/stylelint",
"coding-standards-check/eslint": "eslint --config .eslintrc.js 'assets/**/*.js'",
"coding-standards-check/js": "yarn run coding-standards-check/eslint",
"coding-standards-check": "yarn run coding-standards-check/scss; yarn run coding-standards-check/js; yarn run coding-standards-check/markdownlint",
"coding-standards-check": "yarn run coding-standards-check/scss; yarn run coding-standards-check/js",
"coding-standards-apply/stylelint": "stylelint --config=.stylelintrc.js 'assets/**/*.scss' --fix",
"coding-standards-apply/scss": "yarn run coding-standards-apply/stylelint",
"coding-standards-apply/eslint": "eslint --config .eslintrc.js 'assets/**/*.js' --fix",
Expand Down
Loading