Improved release.yml #7
Workflow file for this run
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
name: "Release" | |
on: | |
push: | |
tags: | |
- "v*" | |
permissions: | |
contents: read | |
env: | |
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress" | |
PROJECT_NAME: 'm4b-tool' | |
jobs: | |
build: | |
permissions: | |
contents: write # for actions/create-release to create a release | |
name: Upload Release Asset | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
extensions: "intl" | |
ini-values: "memory_limit=128M" | |
php-version: "8.2" | |
- name: Get version | |
id: version | |
uses: battila7/get-version-action@v2 | |
- name: Build | |
id: build | |
shell: bash | |
run: | | |
sed -i "s/@package_version@/${{ steps.version.outputs.version-without-v }}/g" bin/m4b-tool.php | |
composer install ${{ env.COMPOSER_FLAGS }} \ | |
&& composer bin box require --dev humbug/box \ | |
&& php -d phar.readonly=off vendor/bin/box compile \ | |
&& chmod +x dist/*.phar \ | |
&& zip dist/${{ env.PROJECT_NAME }}-${{ steps.version.outputs.version-without-v }}.zip dist/m4b-tool.phar \ | |
&& tar czvf dist/${{ env.PROJECT_NAME }}-${{ steps.version.outputs.version-without-v }}.tar.gz ./dist/m4b-tool.phar | |
# RELEASE to github | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: doc/release/release-notes-${{ steps.version.outputs.version }}.md | |
draft: false | |
files: | | |
dist/${{ env.PROJECT_NAME }}-${{ steps.version.outputs.version-without-v }}.tar.gz | |
dist/${{ env.PROJECT_NAME }}-${{ steps.version.outputs.version-without-v }}.zip | |
dist/m4b-tool.phar | |
# RELEASE to dockerhub | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . # uses | |
# file: ${{ github.event.inputs.image }}/${{ github.event.inputs.version }}/Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 | |
#platforms: linux/386,linux/ppc64le,linux/s390x,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 | |
push: true | |
tags: sandreas/m4b-tool:latest,sandreas/m4b-tool:${{ steps.version.outputs.version-without-v }} | |
build-args: | | |
REF_NAME=${{ github.ref_name }} | |
# RELEASE to homebrew | |
# - name: Release project to Homebrew tap | |
# uses: Justintime50/homebrew-releaser@v2 | |
# with: | |
# homebrew_owner: sandreas | |
# homebrew_tap: homebrew-tap | |
# formula_folder: Formula | |
# github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
# commit_owner: sandreas | |
# commit_email: [email protected] | |
# version: ${{ steps.version.outputs.version-without-v }} | |
# install: 'bin.install "m4b-tool.phar" => "m4b-tool"' | |
# test: 'assert_equal "m4b-tool v.#{version}", shell_output("#{bin}/m4b-tool --version").chomp' | |
# depends_on: | | |
# "fdk-aac-encoder" | |
# "mp4v2" | |
# "php" | |
# update_readme_table: false | |
# skip_commit: false | |
# - 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 [email protected] --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 | |
# 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" | |
# uses: actions/github-script@v7 | |
# 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 | |
# github.rest.issues.create({ | |
# owner: "${{ github.repository_owner }}", | |
# repo: "docker", | |
# title: `New Composer tag: ${ tag }`, | |
# body: `https://github.com/${{ github.repository }}/releases/tag/${ tag }`, | |
# }); |