-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #292 from ergebnis/feature/phar
Enhancement: Compile, sign, and upload composer-normalize.phar on tag
- Loading branch information
Showing
14 changed files
with
1,541 additions
and
25 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions | ||
|
||
name: "Continuous Deployment" | ||
|
||
on: | ||
push: | ||
tags: | ||
- "**" | ||
|
||
env: | ||
REQUIRED_PHP_EXTENSIONS: "mbstring" | ||
|
||
jobs: | ||
release: | ||
name: "Release" | ||
|
||
runs-on: "ubuntu-latest" | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- "7.4" | ||
|
||
dependencies: | ||
- "locked" | ||
|
||
env: | ||
COMPOSER_NORMALIZE_PHAR: ".build/phar/composer-normalize.phar" | ||
COMPOSER_NORMALIZE_PHAR_SIGNATURE: ".build/phar/composer-normalize.phar.asc" | ||
GPG_KEYS: ".build/phar/keys.asc" | ||
GPG_KEYS_ENCRYPTED: "phar/keys.asc.gpg" | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: "actions/[email protected]" | ||
|
||
- name: "Install PHP with extensions" | ||
uses: "shivammathur/[email protected]" | ||
with: | ||
coverage: "none" | ||
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}" | ||
php-version: "${{ matrix.php-version }}" | ||
|
||
- name: "Validate composer.json and composer.lock" | ||
run: "composer validate --strict" | ||
working-directory: "phar" | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: "actions/[email protected]" | ||
with: | ||
path: "~/.composer/cache" | ||
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}-phar" | ||
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-phar" | ||
|
||
- name: "Install locked dependencies required for compiling Phar with composer" | ||
run: "composer install --no-interaction --no-progress --no-suggest" | ||
working-directory: "phar" | ||
|
||
- name: "Copy files" | ||
run: "cp -r resource phar/resource && cp -r src phar/src" | ||
|
||
- name: "Validate configuration for humbug/box" | ||
run: "phar/box.phar validate phar/box.json" | ||
|
||
- name: "Compile composer-normalize.phar with humbug/box" | ||
run: "phar/box.phar compile --config=phar/box.json" | ||
|
||
- name: "Show info about composer-normalize.phar with humbug/box" | ||
run: "phar/box.phar info ${{ env.COMPOSER_NORMALIZE_PHAR }}" | ||
|
||
- name: "Run composer-normalize.phar" | ||
run: "${{ env.COMPOSER_NORMALIZE_PHAR }}" | ||
|
||
- name: "Show gpg version" | ||
run: "gpg --version" | ||
|
||
- name: "Decrypt keys.asc.gpg with gpg" | ||
run: "gpg --batch --output ${{ env.GPG_KEYS }} --passphrase \"${{ secrets.GPG_DECRYPT_PASSPHRASE }}\" --yes --decrypt ${{ env.GPG_KEYS_ENCRYPTED }}" | ||
|
||
- name: "Import keys from keys.asc with gpg" | ||
run: "gpg --batch --import ${{ env.GPG_KEYS }}" | ||
|
||
- name: "Sign composer-normalize.phar with gpg" | ||
run: "gpg --armor --local-user \"${{ secrets.GPG_LOCAL_USER }}\" --output ${{ env.COMPOSER_NORMALIZE_PHAR_SIGNATURE }} --passphrase \"${{ secrets.GPG_KEY_PASSPHRASE }}\" --pinentry-mode loopback --yes --detach-sig ${{ env.COMPOSER_NORMALIZE_PHAR }}" | ||
|
||
- name: "Verify signature of composer-normalize.phar with gpg" | ||
run: "gpg --verify ${{ env.COMPOSER_NORMALIZE_PHAR_SIGNATURE }} ${{ env.COMPOSER_NORMALIZE_PHAR }}" | ||
|
||
- name: "Remove decrypted keys.asc" | ||
run: "rm ${{ env.GPG_KEYS }}" | ||
|
||
- name: "Determine tag" | ||
id: "determine-tag" | ||
run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\"" | ||
|
||
- name: "Create release" | ||
id: "create-release" | ||
uses: "actions/[email protected]" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
with: | ||
draft: false | ||
prerelease: false | ||
release_name: "${{ steps.determine-tag.outputs.tag }}" | ||
tag_name: "${{ steps.determine-tag.outputs.tag }}" | ||
|
||
- name: "Upload composer-normalize.phar" | ||
uses: "actions/[email protected]" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
with: | ||
asset_content_type: "text/plain" | ||
asset_name: "composer-normalize.phar" | ||
asset_path: "${{ env.COMPOSER_NORMALIZE_PHAR }}" | ||
upload_url: "${{ steps.create-release.outputs.upload_url }}" | ||
|
||
- name: "Upload composer-normalize.phar.asc" | ||
uses: "actions/[email protected]" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
with: | ||
asset_content_type: "text/plain" | ||
asset_name: "composer-normalize.phar.asc" | ||
asset_path: "${{ env.COMPOSER_NORMALIZE_PHAR_SIGNATURE }}" | ||
upload_url: "${{ steps.create-release.outputs.upload_url }}" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
/.build/ | ||
/phar/resource/ | ||
/phar/src/ | ||
/phar/vendor/ | ||
/vendor/ |
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
Oops, something went wrong.