-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
ef2c15c
commit b5c19a7
Showing
31 changed files
with
598 additions
and
363 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,7 +92,7 @@ jobs: | |
- run: | ||
name: Deployment 1 | ||
command: | | ||
vendor/bin/robo artifact \ | ||
./git-artifact \ | ||
[email protected]:drevops/git-artifact-destination.git \ | ||
--branch=mode--force-push--circleci--[branch] \ | ||
--mode=force-push \ | ||
|
@@ -117,7 +117,7 @@ jobs: | |
- run: | ||
name: Deployment 2 | ||
command: | | ||
vendor/bin/robo artifact \ | ||
./git-artifact \ | ||
[email protected]:drevops/git-artifact-destination.git \ | ||
--branch=mode--force-push--circleci--[branch] \ | ||
--mode=force-push \ | ||
|
@@ -166,7 +166,7 @@ jobs: | |
- run: | ||
name: Deployment 1 | ||
command: | | ||
vendor/bin/robo artifact \ | ||
./git-artifact \ | ||
[email protected]:drevops/git-artifact-destination.git \ | ||
--branch=mode--branch--circleci--[branch]--[timestamp:Y-m-d_H-i] \ | ||
--mode=branch \ | ||
|
@@ -183,7 +183,7 @@ jobs: | |
- run: | ||
name: Deployment 2 - same branch | ||
command: | | ||
vendor/bin/robo artifact \ | ||
./git-artifact \ | ||
[email protected]:drevops/git-artifact-destination.git \ | ||
--branch=mode--branch--circleci--[branch]--[timestamp:Y-m-d_H-i] \ | ||
--mode=branch \ | ||
|
@@ -203,7 +203,7 @@ jobs: | |
- run: | ||
name: Deployment 2 - new branch | ||
command: | | ||
vendor/bin/robo artifact \ | ||
./git-artifact \ | ||
[email protected]:drevops/git-artifact-destination.git \ | ||
--branch=mode--branch--circleci--[branch]--[timestamp:Y-m-d_H-i-s] \ | ||
--mode=branch \ | ||
|
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,47 @@ | ||
name: Release PHP | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release-php: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache Composer dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/composer-cache | ||
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
|
||
- name: Install dependencies | ||
run: composer install | ||
|
||
- name: Build PHAR | ||
run: composer build | ||
|
||
- name: Test PHAR | ||
run: ./.build/git-artifact || exit 1 | ||
|
||
- name: Get tag name | ||
id: get-version | ||
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
./.build/git-artifact |
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 |
---|---|---|
|
@@ -66,9 +66,41 @@ jobs: | |
fail_ci_if_error: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
build-php: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache Composer dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/composer-cache | ||
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
|
||
- name: Install dependencies | ||
run: composer install | ||
|
||
- name: Check composer version | ||
run: composer --version | ||
|
||
- name: Build PHAR | ||
run: composer build | ||
|
||
- name: Test PHAR | ||
run: ./.build/git-artifact --help || exit 1 | ||
#;> PHP_PHAR | ||
|
||
# Demonstration of deployment in 'force-push' mode. | ||
deploy-force-push: | ||
needs: test-php | ||
needs: | ||
- test-php | ||
- build-php | ||
|
||
runs-on: ubuntu-latest | ||
|
||
|
@@ -123,7 +155,7 @@ jobs: | |
- name: Deployment 1 | ||
run: | | ||
vendor/bin/robo artifact \ | ||
./git-artifact \ | ||
[email protected]:drevops/git-artifact-destination.git \ | ||
--branch=mode--force-push--gha--[branch] \ | ||
--mode=force-push \ | ||
|
@@ -146,7 +178,7 @@ jobs: | |
- name: Deployment 2 | ||
run: | | ||
vendor/bin/robo artifact \ | ||
./git-artifact \ | ||
[email protected]:drevops/git-artifact-destination.git \ | ||
--branch=mode--force-push--gha--[branch] \ | ||
--mode=force-push \ | ||
|
@@ -164,7 +196,9 @@ jobs: | |
# of the second push. This is because the mode is intended to create a new | ||
# branch per artifact deployment. | ||
deploy-branch: | ||
needs: test-php | ||
needs: | ||
- test-php | ||
- build-php | ||
|
||
runs-on: ubuntu-latest | ||
|
||
|
@@ -223,7 +257,7 @@ jobs: | |
- name: Deployment 1 | ||
run: | | ||
vendor/bin/robo artifact \ | ||
./git-artifact \ | ||
[email protected]:drevops/git-artifact-destination.git \ | ||
--branch=mode--branch--gha--[branch]--[timestamp:Y-m-d_H-i] \ | ||
--mode=branch \ | ||
|
@@ -246,7 +280,7 @@ jobs: | |
- name: Deployment 2 - same branch | ||
run: | | ||
vendor/bin/robo artifact \ | ||
./git-artifact \ | ||
[email protected]:drevops/git-artifact-destination.git \ | ||
--branch=mode--branch--gha--[branch]--[timestamp:Y-m-d_H-i] \ | ||
--mode=branch \ | ||
|
@@ -257,7 +291,7 @@ jobs: | |
- name: Deployment 2 - new branch | ||
run: | | ||
vendor/bin/robo artifact \ | ||
./git-artifact \ | ||
[email protected]:drevops/git-artifact-destination.git \ | ||
--branch=mode--branch--gha--[branch]--[timestamp:Y-m-d_H-i-s] \ | ||
--mode=branch \ | ||
|
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 |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
/cobertura.xml | ||
/composer.lock | ||
/vendor | ||
/vendor-bin |
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 |
---|---|---|
|
@@ -93,34 +93,8 @@ composer require drevops/git-artifact | |
``` | ||
|
||
## Usage | ||
|
||
Use provided [`RoboFile.php`](RoboFile.php) or create a custom `RoboFile.php` | ||
in your repository with the following content: | ||
|
||
```php | ||
<?php | ||
use DrevOps\Robo\ArtifactTrait; | ||
|
||
/** | ||
* Class RoboFile. | ||
*/ | ||
class RoboFile extends \Robo\Tasks | ||
{ | ||
|
||
use ArtifactTrait { | ||
ArtifactTrait::__construct as private __artifactConstruct; | ||
} | ||
|
||
public function __construct() | ||
{ | ||
$this->__artifactConstruct(); | ||
} | ||
} | ||
``` | ||
|
||
### Run | ||
```shell | ||
vendor/bin/robo artifact [email protected]:yourorg/your-repo-destination.git | ||
./git-artifact [email protected]:yourorg/your-repo-destination.git | ||
``` | ||
|
||
This will create an artifact from current directory and will send it to the | ||
|
@@ -136,8 +110,7 @@ See examples: | |
Call from CI configuration or deployment script: | ||
```shell | ||
export DEPLOY_BRANCH=<YOUR_CI_PROVIDER_BRANCH_VARIABLE> | ||
vendor/bin/robo --load-from "${HOME}/.composer/vendor/drevops/git-artifact/RoboFile.php" artifact \ | ||
[email protected]:yourorg/your-repo-destination.git \ | ||
./git-artifact [email protected]:yourorg/your-repo-destination.git \ | ||
--branch="${DEPLOY_BRANCH}" \ | ||
--push | ||
``` | ||
|
This file was deleted.
Oops, something went wrong.
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,13 @@ | ||
{ | ||
"output": ".build/git-artifact", | ||
"compression": "GZ", | ||
"finder": [ | ||
{ | ||
"in": "./", | ||
"exclude": [ | ||
"php-script", | ||
"tests" | ||
] | ||
} | ||
] | ||
} |
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,12 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
foreach ([$GLOBALS['_composer_autoload_path'] ?? NULL, __DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php'] as $file) { | ||
if ($file && file_exists($file)) { | ||
require_once $file; | ||
unset($file); | ||
break; | ||
} | ||
} | ||
|
||
require __DIR__ . '/src/app.php'; |
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 |
---|---|---|
|
@@ -9,7 +9,6 @@ parameters: | |
paths: | ||
- src | ||
- tests | ||
- RoboFile.php | ||
|
||
excludePaths: | ||
- vendor/* | ||
|
Oops, something went wrong.