Skip to content

Commit

Permalink
Merge pull request #222 from TransbankDevelopers/chore/migrate-travis…
Browse files Browse the repository at this point in the history
…-to-github-actions

chore: migrate travis ci to github actions
  • Loading branch information
mastudillot authored Mar 18, 2024
2 parents 939fc1b + db4d735 commit e2b0db6
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 37 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release
on:
release:
types: [created]

jobs:
release:
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Release
run: |
chmod +x package.sh
chmod +x scripts/deploy.sh
./package.sh
./scripts/deploy.sh
env:
WP_ORG_PASSWORD: ${{ secrets.WP_ORG_PASSWORD }}
TAG: ${{ github.event.release.tag_name }}
- name: Upload assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: |
transbank-webpay-plus-rest.zip
transbank-webpay-plus-rest-guzzle7.zip
asset_name: |
transbank-webpay-plus-rest.zip
transbank-webpay-plus-rest-guzzle7.zip
asset_content_type: application/zip
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

14 changes: 7 additions & 7 deletions package.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/sh

#Script for create the plugin artifact
echo "Travis tag: $TRAVIS_TAG"
echo "Tag: $TAG"

if [ "$TRAVIS_TAG" = "" ]
if [ "$TAG" = "" ]
then
TRAVIS_TAG='1.0.0'
TAG='1.0.0'
fi

SRC_DIR="plugin"
Expand All @@ -18,7 +18,7 @@ COMPOSER_LOCK_FILE="composer.lock"
cd $SRC_DIR
composer update
composer install --no-dev
npm install
npm install --no-audit --no-fund --no-optional
npm run build
if [ $? -eq 0 ]; then
rm -rf node_modules/
Expand All @@ -29,8 +29,8 @@ else
fi
cd ..

sed -i.bkp "s/Version: VERSION_REPLACE_HERE/Version: ${TRAVIS_TAG#"v"}/g" "$SRC_DIR/$MAIN_FILE"
sed -i.bkp "s/VERSION_REPLACE_HERE/${TRAVIS_TAG#"v"}/g" "$SRC_DIR/$README_FILE"
sed -i.bkp "s/Version: VERSION_REPLACE_HERE/Version: ${TAG#"v"}/g" "$SRC_DIR/$MAIN_FILE"
sed -i.bkp "s/VERSION_REPLACE_HERE/${TAG#"v"}/g" "$SRC_DIR/$README_FILE"
cp "$SRC_DIR/$COMPOSER_LOCK_FILE" "$SRC_DIR/$COMPOSER_LOCK_FILE.bkp"

PLUGIN_FILE="transbank-webpay-plus-rest.zip"
Expand Down Expand Up @@ -58,6 +58,6 @@ rm "$SRC_DIR/$MAIN_FILE.bkp"
cp "$SRC_DIR/$README_FILE.bkp" "$SRC_DIR/$README_FILE"
rm "$SRC_DIR/$README_FILE.bkp"

echo "Plugin version: $TRAVIS_TAG"
echo "Plugin version: $TAG"
echo "Plugin file: $PLUGIN_FILE"
echo "Plugin file Guzzle 7: $PLUGIN_FILE_GUZZLE"
8 changes: 4 additions & 4 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

if [[ -z "$TRAVIS" ]]; then
echo "Script is only to be run by Travis CI" 1>&2
if [[ -z "$GITHUB_ACTIONS" ]]; then
echo "Script is only to be run by GitHub Actions" 1>&2
exit 1
fi

Expand All @@ -10,7 +10,7 @@ if [[ -z "$WP_ORG_PASSWORD" ]]; then
exit 1
fi

if [[ -z "$TRAVIS_TAG" ]]; then
if [[ -z "$TAG" ]]; then
echo "Build branch is required and must be a tag" 1>&2
exit 0
fi
Expand All @@ -20,7 +20,7 @@ PLUGIN="transbank-webpay-plus-rest"
PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
PLUGIN_BUILDS_PATH="$PROJECT_ROOT/builds"
PLUGIN_BUILD_CONFIG_PATH="$PROJECT_ROOT/build-cfg"
VERSION=$TRAVIS_TAG
VERSION=$TAG
ZIP_FILE="$PROJECT_ROOT/$PLUGIN.zip"

# Ensure the zip file for the current version has been built
Expand Down

0 comments on commit e2b0db6

Please sign in to comment.