revert #3868
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
name: Centos7 CI (push and/or release) | |
on: | |
release: | |
types: [created] | |
push: | |
branches: | |
- develop | |
- fix/centos-build | |
- dependabot/* | |
schedule: | |
- cron: '21 2 * * *' | |
workflow_call: | |
inputs: | |
run-tests: | |
required: true | |
type: string | |
target_branch: | |
required: true | |
type: string | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} | |
IS_PUSH: ${{ github.event_name == 'push' }} | |
REF: ${{ inputs.target_branch =='' && github.ref_name || inputs.target_branch}} | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
#sparse checkout dockerfiles | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
sparse-checkout: | | |
docker/Dockerfile | |
docker/AntaresDeps | |
ref : ${{ env.REF }} | |
- name: set env variables -- DockerFiles | |
run: | | |
echo "DOCKERFILE=$(pwd)/docker/Dockerfile" >> $GITHUB_ENV | |
echo "DOCKERDIR=$(pwd)/docker" >> $GITHUB_ENV | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
docker/AntaresDeps | |
- name: Docker file push | |
id: docker_push | |
if: steps.changed-files.outputs.any_changed == 'true' | |
uses: elgohr/Publish-Docker-Github-Action@main | |
with: | |
name: antaresrte/antaressystemdeps | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
workdir: ${{ env.DOCKERDIR }} | |
dockerfile: ${{ env.DOCKERDIR }}/AntaresDeps | |
cache: false | |
tags: latest | |
- name: Build the image and Antares | |
run: | | |
docker build \ | |
-t antares:centos7 \ | |
--build-arg="BRANCH=${{ env.REF }}" \ | |
--build-arg="NPROC=$(nproc)" \ | |
-f ${{ env.DOCKERFILE }} . | |
- name: create a container without starting it && retrieve the .tgz | |
run: | | |
container_id=$(docker create antares:centos7) | |
mkdir archive | |
docker cp $container_id:/workspace/Antares_Simulator/_build/antares-9.2.0-rc5-CentOS-7.9.2009.tar.gz archive/ | |
docker rm $container_id | |
- name: Install gh if needed | |
if: ${{ env.IS_RELEASE == 'true' }} | |
run: | | |
wget https://github.com/cli/cli/releases/download/v2.52.0/gh_2.52.0_linux_amd64.rpm | |
rpm -i gh_2.52.0_linux_amd64.rpm | |
gh --version | |
- name: Publish assets | |
if: ${{ env.IS_RELEASE == 'true' }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
tag: ${{ github.event.inputs.release_tag }} | |
run: | | |
gh release upload "$tag" archive/*.tar.gz _build/*.rpm | |