diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5d531fadc..c62e749b3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,6 +10,7 @@ on: - "!gh-pages" # excludes gh-pages branch pull_request: branches: + - "**" # matches every branch - master - 1.7 workflow_dispatch: @@ -157,19 +158,39 @@ jobs: runs-on: ubuntu-latest needs: pytest steps: - - name: Set custom variables + - name: some check + run: | + echo "GITHUB_REF: ${GITHUB_REF}" + env + + - name: make date tag + id: mkdatetag + run: echo "::set-output name=dtag::$(date +%Y%m%d_%H%M%S)" + + - name: make ref tag case 1 + id: mkreftag1 + if: ${{ github.event.inputs.ref != '' }} + run: echo "::set-output name=reftag::${{github.event.inputs.ref}}" + + - name: make ref tag case 2 + id: mkreftag2 + if: ${{ github.event.inputs.ref == '' }} + run: echo "::set-output name=reftag::${GITHUB_BASE_REF:+PR}"$(awk -F"/" '{print $3}' <<< ${GITHUB_REF}) + + - name: check tags run: | - echo "timestamp=$(date +%Y%m%d-%H%M%S)" >> ${GITHUB_ENV} - export my_branch_tmp=${{github.event.inputs.ref}} - echo "mybranch=${my_branch_tmp:-${GITHUB_REF##*/}}" >> ${GITHUB_ENV} - echo "mybranchref=${my_branch_tmp:-${GITHUB_REF}}" >> ${GITHUB_ENV} - cat ${GITHUB_ENV} + echo "GITHUB_REF: ${GITHUB_REF}" + echo "GITHUB_BASE_REF: ${GITHUB_BASE_REF}" + echo "github.event.inputs.ref: #${{github.event.inputs.ref}}#${{ github.event.inputs.ref != '' }}#${{ github.event.inputs.ref == '' }}#" + echo "mkdatetag: ${{steps.mkdatetag.outputs.dtag}}" + echo "mkreftag1: ${{steps.mkreftag1.outputs.reftag}}" + echo "mkreftag2: ${{steps.mkreftag2.outputs.reftag}}" - name: checkout code tree uses: actions/checkout@v2 with: fetch-depth: 0 - ref: ${{env.mybranchref}} + ref: ${{github.event.inputs.ref}} - name: Run the build in a container (SL7/HEPCloud-CI) uses: ./.github/actions/python-command-in-sl7-container @@ -180,6 +201,6 @@ jobs: - name: Archive rpm uses: actions/upload-artifact@v2 with: - name: rpms-DE-${{env.mybranch}}-${{env.timestamp}} + name: rpms-DE-${{steps.mkreftag1.outputs.reftag}}${{steps.mkreftag2.outputs.reftag}}-${{steps.mkdatetag.outputs.dtag}} path: dist/*.rpm if-no-files-found: error