2020-04-22 07:27:58 +00:00
|
|
|
name: "Release"
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2020-04-22 07:30:34 +00:00
|
|
|
tags:
|
2020-04-22 07:31:04 +00:00
|
|
|
- "*"
|
2020-04-22 07:27:58 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Upload Release Asset
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2022-03-05 18:17:37 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-04-22 07:27:58 +00:00
|
|
|
|
|
|
|
- name: "Install PHP"
|
|
|
|
uses: "shivammathur/setup-php@v2"
|
|
|
|
with:
|
|
|
|
coverage: "none"
|
|
|
|
extensions: "intl"
|
|
|
|
ini-values: "memory_limit=-1"
|
2022-07-01 10:22:11 +00:00
|
|
|
php-version: "8.1"
|
2020-04-22 07:27:58 +00:00
|
|
|
|
|
|
|
- name: "Install dependencies from composer.lock using composer binary provided by system"
|
|
|
|
run: "composer install ${{ env.COMPOSER_FLAGS }}"
|
|
|
|
|
|
|
|
- name: "Run install again using composer binary from source"
|
|
|
|
run: "bin/composer install ${{ env.COMPOSER_FLAGS }}"
|
|
|
|
|
|
|
|
- name: "Validate composer.json"
|
|
|
|
run: "bin/composer validate"
|
|
|
|
|
|
|
|
- name: Build phar file
|
|
|
|
run: "php -d phar.readonly=0 bin/compile"
|
|
|
|
|
|
|
|
- name: Create release
|
|
|
|
id: create_release
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
tag_name: ${{ github.ref }}
|
|
|
|
release_name: ${{ github.ref }}
|
|
|
|
draft: true
|
|
|
|
body: TODO
|
|
|
|
|
|
|
|
- name: Upload phar
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: ./composer.phar
|
|
|
|
asset_name: composer.phar
|
|
|
|
asset_content_type: application/octet-stream
|
2020-06-29 11:11:53 +00:00
|
|
|
|
2020-10-27 14:55:21 +00:00
|
|
|
- name: Configure GPG key and sign phar
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.gnupg/
|
|
|
|
chmod 0700 ~/.gnupg/
|
|
|
|
echo "$GPG_SIGNING_KEY" > ~/.gnupg/private.key
|
|
|
|
gpg --import ~/.gnupg/private.key
|
|
|
|
gpg -u contact@packagist.com --detach-sign --output composer.phar.asc composer.phar
|
|
|
|
env:
|
|
|
|
GPG_SIGNING_KEY: |
|
|
|
|
${{ secrets.GPG_KEY_161DFBE342889F01DDAC4E61CBB3D576F2A0946F }}
|
|
|
|
|
|
|
|
- name: Upload phar signature
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: ./composer.phar.asc
|
|
|
|
asset_name: composer.phar.asc
|
|
|
|
asset_content_type: application/octet-stream
|
|
|
|
|
2020-06-29 11:11:53 +00:00
|
|
|
# This step requires a secret token with `pull` access to composer/docker. The default
|
|
|
|
# secrets.GITHUB_TOKEN is scoped to this repository only which is not sufficient.
|
|
|
|
- name: "Open issue @ Docker repository"
|
2022-03-15 09:22:01 +00:00
|
|
|
uses: actions/github-script@v6
|
2020-06-29 11:11:53 +00:00
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
|
|
|
|
script: |
|
|
|
|
// github.ref value looks like 'refs/tags/TAG', cleanup
|
|
|
|
const tag = "${{ github.ref }}".replace(/refs\/tags\//, '');
|
|
|
|
// create new issue on Docker repository
|
2022-03-15 09:22:01 +00:00
|
|
|
github.rest.issues.create({
|
2020-06-29 11:11:53 +00:00
|
|
|
owner: "${{ github.repository_owner }}",
|
|
|
|
repo: "docker",
|
|
|
|
title: `New Composer tag: ${ tag }`,
|
|
|
|
body: `https://github.com/${{ github.repository }}/releases/tag/${ tag }`,
|
|
|
|
});
|