Merge pull request #59 from omnimail/development #10
This file contains hidden or 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: | |
branches: | |
- master | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Get branch | |
id: branch | |
run: echo "::set-output name=name::$(sed "s/refs\/heads\///g" <<< ${REF})" | |
env: | |
REF: ${{ github.ref }} | |
- name: Checkout | |
run: | | |
git remote rm origin | |
git remote add origin "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" | |
git fetch --all | |
git checkout ${BRANCH} | |
git config --local user.email "${GITHUB_EMAIL}" | |
git config --local user.name "${GITHUB_ACTOR}" | |
env: | |
GITHUB_ACTOR: ${{ secrets.USER_GITHUB_ACTOR }} | |
GITHUB_EMAIL: ${{ secrets.USER_GITHUB_EMAIL }} | |
GITHUB_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }} | |
BRANCH: ${{ steps.branch.outputs.name }} | |
- name: Get version | |
id: version | |
run: | | |
version=$(jq -r '.version' composer.json) | |
tag=$((git show-ref --tags | grep "refs/tags/${version}$") || true) | |
[[ "$tag" != "" ]] && version="" | |
echo "::set-output name=version::${version}" | |
- name: Create tag | |
if: steps.version.outputs.version != '' | |
run: | | |
git tag -a "${VERSION}" -m "" | |
git push origin "${VERSION}" | |
env: | |
GITHUB_ACTOR: ${{ secrets.USER_GITHUB_ACTOR }} | |
GITHUB_EMAIL: ${{ secrets.USER_GITHUB_EMAIL }} | |
GITHUB_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }} | |
VERSION: ${{ steps.version.outputs.version }} |