deployphp / action

GitHub Action for Deployer
MIT License
222 stars 44 forks source link

Downloaded `deployer.phar` should be the latest version #45

Closed benjaminmal closed 1 year ago

benjaminmal commented 1 year ago

I have this error when running my deployment workflow:

Capture d’écran 2022-09-08 à 14 36 41

It turns out the version downloaded via https://deployer.org/deployer.phar is 6.8.0. I think the action should download the latest version available by default, or maybe a required parameter should be added to select the major version of the downloaded deployer.phar. Linked to https://github.com/deployphp/deployer/issues/3225.

benjaminmal commented 1 year ago

A workaround I found is to use composer to download the last version, and set deployer-binary parameter:

            -   name: Download `deployer.phar`
                run: composer global require deployer/deployer --no-interaction --verbose --ansi

            -   name: Get composer global bin-dir path
                id: composer-bin-dir
                run: echo "::set-output name=path::$(composer global config bin-dir --absolute)"

            -   name: Deploy
                uses: deployphp/action@v1
                with:
                    dep: deploy production
                    deployer-binary: ${{ steps.composer-bin-dir.outputs.path }}/dep
                    private-key: ${{ secrets.HOST_SSH_KEY }}
TTATPuOT commented 1 year ago

Same error. Thanks a lot @benjaminmal for working solution.

I also add

tools: composer:v2

to shivammathur/setup-php@v2 for composer installs.

antonmedv commented 1 year ago

Lets do it this way: if I gonna get donation in amount of $100, I'll work on create a link which points to latest dep phar.

benjaminmal commented 1 year ago

@antonmedv Kind of expensive link :P I can suggest adding a latest version in manifest.json and setting in the action latest as default value for deployer-version. It should work automatically in the action.

[
    ...

    {
        "name": "deployer.phar",
        "sha1": "bf46ca3ff7339d644220e949c2c71994749cf561",
        "url": "https:\/\/github.com\/deployphp\/deployer\/releases\/download\/v7.0.2\/deployer.phar",
        "version": "7.0.2"
    },
    {
        "name": "deployer.phar",
        "sha1": "bf46ca3ff7339d644220e949c2c71994749cf561",
        "url": "https:\/\/github.com\/deployphp\/deployer\/releases\/download\/v7.0.2\/deployer.phar",
        "version": "latest"
    }
]
antonmedv commented 1 year ago

Creating such automation. Or just a link which points to latests require non-zero amount of work. :p

antonmedv commented 1 year ago

Should be fixed.