move everything to glab/gh #2
Workflow file for this run
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
# Copyright 2018-2024 The University of Birmingham | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
--- | ||
name: Hog-tag | ||
on: | ||
workflow_call: | ||
inputs: | ||
HOG_CREATE_OFFICIAL_RELEASE: | ||
required: false | ||
type: boolean | ||
HOG_OFFICIAL_BIN_EOS_PATH: | ||
type: string | ||
required: false | ||
HOG_OFFICIAL_BIN_PATH: | ||
type: string | ||
required: false | ||
HOG_USE_DOXYGEN: | ||
required: false | ||
type: boolean | ||
secrets: | ||
HOG_PUSH_TOKEN: | ||
required: true | ||
HOG_EMAIL: | ||
required: true | ||
HOG_USER: | ||
required: true | ||
EOS_PASSWORD: | ||
required: false | ||
EOS_USER: | ||
required: false | ||
EOS_MGM_URL: | ||
required: false | ||
env: | ||
PR_NUMBER: ${{ github.event.number }} | ||
HOG_PUSH_TOKEN: ${{ secrets.HOG_PUSH_TOKEN }} | ||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | ||
HOG_USER: ${{ secrets.HOG_USER }} | ||
HOG_EMAIL: ${{ secrets.HOG_EMAIL }} | ||
HOG_PATH: ${{ secrets.HOG_PATH }} | ||
EOS_USER: ${{ secrets.EOS_USER }} | ||
EOS_PASSWORD: ${{ secrets.EOS_PASSWORD }} | ||
GH_TOKEN: ${{ secrets.HOG_PUSH_TOKEN }} | ||
jobs: | ||
get_artifacts: | ||
runs-on: ubuntu-latest | ||
container: gitlab-registry.cern.ch/hog/hog-docker | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Checkout Repository | ||
with: | ||
fetch-depth: 0 | ||
token: ${{secrets.HOG_PUSH_TOKEN}} | ||
submodules: 'true' | ||
- name: Get Artifacts | ||
id: artifacts | ||
shell: bash | ||
run: | | ||
git config --global user.email "$HOG_EMAIL" | ||
git config --global user.name "$HOG_USER" | ||
git fetch | ||
git checkout $GITHUB_HEAD_REF | ||
git submodule init | ||
git submodule update | ||
source ./Hog/Other/CommonFunctions.sh | ||
git fetch origin refs/notes/*:refs/notes/* | ||
note=(`git notes show`) || { | ||
echo "No note found, probably you pushed to a branch that should protected (e.g. master, develop)"; | ||
exit 1; | ||
} | ||
runid=${note[0]} | ||
tag=${note[2]} | ||
echo "PR number $runid" | ||
if [[ "${{ inputs.HOG_USE_DOXYGEN }}" == "1" ]]; then | ||
dox_var="-doxygen" | ||
fi | ||
./Hog/Other/GetArtifactsAndRename.sh -mr ${runid} -github ${dox_var} | ||
echo "tag=$new_tag" >> $GITHUB_OUTPUT | ||
echo "runid=${note[0]}" >> $GITHUB_OUTPUT | ||
- name: Archive Simulation Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Archive-Artifacts | ||
path: | | ||
bin | ||
Doc | ||
archive_binary_files: | ||
runs-on: self-hosted | ||
if: ${{ inputs.HOG_OFFICIAL_BIN_EOS_PATH != '' || inputs.HOG_OFFICIAL_BIN_PATH != '' }} | ||
needs: get_artifacts | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
name: Download Artifacts | ||
- name: Archive | ||
shell: bash | ||
run: | | ||
if [[ "${{ inputs.HOG_OFFICIAL_BIN_PATH}}" != "" ]]; then | ||
BIN_PATH=${{ inputs.HOG_OFFICIAL_BIN_PATH}} | ||
elif [[ "${{ inputs.HOG_OFFICIAL_BIN_EOS_PATH }}" != "" ]]; then | ||
BIN_PATH=${{ inputs.HOG_OFFICIAL_BIN_EOS_PATH }} | ||
echo "From version Hog2024.1, HOG_OFFICIAL_BIN_EOS_PATH variable will be deprecated. Please use HOG_OFFICIAL_BIN_PATH to define the path where to copy the official bitfiles." | ||
fi | ||
if [[ $BIN_PATH == /eos/* ]]; then | ||
until echo $EOS_PASSWORD | kinit -V [email protected]; do | ||
echo Retrying; | ||
sleep 2; | ||
done; | ||
fi; | ||
if [ -v "${{ secrets.EOS_MGM_URL}}" ]; then | ||
export EOS_MGM_URL=${{ secrets.EOS_MGM_URL }} | ||
else | ||
export EOS_MGM_URL="root://eosuser.cern.ch" | ||
fi; | ||
echo "Copying Doxygen documentation to $BIN_PATH/Doc" | ||
if [[ $BIN_PATH == /eos/* ]]; then | ||
eos mkdir -p $BIN_PATH/Doc | ||
xrdcp -rsf Archive-Artifacts/Doc/html/* ${EOS_MGM_URL}/$BIN_PATH/Doc | ||
else | ||
mkdir -p $BIN_PATH/Doc | ||
cp -r Archive-Artifacts/Doc/html/* $BIN_PATH/Doc | ||
fi; | ||
echo "Copying binary files to $BIN_PATH/${tag}"; | ||
if [[ $BIN_PATH == /eos/* ]]; then | ||
eos mkdir $BIN_PATH/${tag}; | ||
xrdcp -rfs Archive-Artifacts/bin/* ${EOS_MGM_URL}//$BIN_PATH/${tag}; | ||
else | ||
mkdir $BIN_PATH/${tag}; | ||
cp -r Archive-Artifacts/bin/* $BIN_PATH/${tag}; | ||
fi; | ||
create_github_release: | ||
runs-on: ubuntu-latest | ||
container: gitlab-registry.cern.ch/hog/hog-docker | ||
if: ${{ inputs.HOG_CREATE_OFFICIAL_RELEASE }} | ||
needs: get_artifacts | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Checkout Repository | ||
with: | ||
fetch-depth: 0 | ||
token: ${{secrets.HOG_PUSH_TOKEN}} | ||
submodules: 'true' | ||
- uses: actions/download-artifact@v4 | ||
name: Download Artifacts | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
release_name: Release ${{ github.ref_name }} | ||
body_path: Archive-Artifacts/bin/note.md | ||
draft: false | ||
prerelease: false | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./binaries.zip | ||
asset_name: Binaries | ||
asset_content_type: application/zip |