Skip to content

switch to main branch #25

switch to main branch

switch to main branch #25

name: Upload release github
on:
push:
tags:
- release.**
jobs:
job1:
runs-on: ubuntu-latest
outputs:
branchname: ${{ steps.step1.outputs.branchname }}
steps:
- uses: actions/checkout@v1
- id: step1
run: |
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw/origin\/}
echo "branch detected: $branch"
echo "branchname=$branch" >> $GITHUB_OUTPUT
build:
environment: build
env:
GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
GIT_AUTH_TOKEN: ${{ secrets.GIT_AUTH_TOKEN }}
BRANCH_NAME: ${{ needs.job1.outputs.branchname }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Java
uses: actions/setup-java@v2
with:
distribution: "temurin"
java-version: 17
# Only release from main branch
- name: Upload if on main branch
if: endsWith(${{ env.BRANCH_NAME }}, 'main') == true
run: ./gradlew publish