fixed upload to swift for production and url for docu (#8) #2
Workflow file for this run
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: Create Release | |
| # This workflow is triggered when tagging with v* | |
| # example: | |
| # git tag v0.0.22-beta | |
| # git push origin v0.0.22-beta | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout project | |
| uses: actions/checkout@v4 | |
| - name: Setup java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: "21" | |
| cache: "maven" | |
| server-id: github | |
| - name: setup python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.12 | |
| cache: 'pip' # caching pip dependencies | |
| - name: Install python requirements | |
| run: pip install -r .github/scripts/requirements.txt | |
| - name: Setup maven | |
| uses: stCarolas/setup-maven@v5 | |
| with: | |
| maven-version: 3.6.3 | |
| - name: configure-git-user | |
| run: | | |
| git config user.email "[email protected]" | |
| git config user.name "GitHub Actions" | |
| - name: get-pom-version | |
| id: pom-version | |
| run: | | |
| echo "JAVA_POM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> "$GITHUB_OUTPUT" | |
| - name: print-pom-version | |
| run: echo "JAVA_POM_VERSION=${{ steps.pom-version.outputs.JAVA_POM_VERSION }}" | |
| - name: check-package-exist | |
| id: check_package_exist | |
| run: python3 .github/scripts/existsGitHubPackageVersion.py | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| USERNAME: ${{ github.repository_owner }} | |
| PACKAGE_TYPE: maven | |
| PACKAGE_NAME: com.opentelekomcloud.opentelekomcloud-functiongraph-java | |
| PACKAGE_VERSION_NAME: ${{ steps.pom-version.outputs.JAVA_POM_VERSION }} | |
| OUTPUT_NAME: PACKAGE_EXISTS | |
| - name: echo-if-package-exists | |
| if: "${{ steps.check_package_exist.outputs.PACKAGE_EXISTS == 'true' }}" | |
| run: echo "::notice::Package exsits, skipping upload." | |
| - name: deploy-package-to-github | |
| if: "${{ steps.check_package_exist.outputs.PACKAGE_EXISTS != 'true' }}" | |
| id: deploy_github | |
| run: | | |
| echo "::notice::Uploading Package ..." | |
| mvn -B deploy --file pom.xml \ | |
| -DaltDeploymentRepository="github::https://maven.pkg.github.com/${{ github.repository }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| # https://github.com/ncipollo/release-action/blob/main/.github/workflows/release.yml | |
| id: create_release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| allowUpdates: true | |
| draft: false | |
| generateReleaseNotes: true | |
| body: "See: [FunctionGraph Java Documentation]<https://docs.otc.t-systems.com/opentelekomcloud-functiongraph-java>" | |
| ###################### Publish Documentation | |
| publishDocs: | |
| name: publish-docs | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout project | |
| uses: actions/checkout@v4 | |
| - name: setup python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' # caching pip dependencies | |
| - name: Install tox | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install tox | |
| - name: get git info | |
| id: getgitinfo | |
| run: | | |
| echo "GITHUB_COMMIT_DATE=$(git --no-pager log -1 --pretty='format:%cd' --date='format:%Y-%m-%d %H:%M:%S')" >> "$GITHUB_OUTPUT" | |
| - name: Run Tox for Documentation | |
| env: | |
| GH_ACTIONS_GIT_BRANCH: ${{ github.head_ref || github.ref_name }} | |
| GH_ACTIONS_GIT_COMMIT_DATE: ${{ steps.getgitinfo.outputs.GITHUB_COMMIT_DATE }} | |
| GH_ACTIONS_GIT_COMMIT_HASH: ${{ github.sha }} | |
| run: tox -e docs | |
| - name: Compress documentation into .tar.gz | |
| run: | | |
| tar -czf docs-html.tar.gz -C doc/build/html . | |
| mkdir -p ./library | |
| cp docs-html.tar.gz ./library/docs-html.tar.gz | |
| cp docs-html.tar.gz playbooks/docs-html.tar.gz | |
| - name: Write clouds.yaml | |
| run: | | |
| mkdir -p ~/.config/openstack | |
| cat > ~/.config/openstack/clouds.yaml <<EOF | |
| clouds: | |
| otc: | |
| profile: otc | |
| auth: | |
| auth_url: https://iam.eu-de.otc.t-systems.com:443/v3 | |
| username: ${{ secrets.OTC_AUTH_USERNAME }} | |
| password: ${{ secrets.OTC_AUTH_PASSWORD }} | |
| project_name: ${{ secrets.OTC_PROJECT_NAME }} | |
| user_domain_name: ${{ secrets.OTC_DOMAIN }} | |
| interface: public | |
| identity_api_version: 3 | |
| object_store_endpoint_override: ${{ secrets.OTC_ENDPOINT_STORAGE }} | |
| EOF | |
| - name: Install dependencies for Swift upload | |
| run: | | |
| python -m pip install openstacksdk ansible requests requestsexceptions ansible | |
| - name: Upload to Swift | |
| run: | | |
| ansible-playbook -i localhost, -M .github/workflows/library playbooks/upload_swift.yml | |