-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
46 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,20 +12,24 @@ jobs: | |
release-context: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version-name: ${{github.ref_name}} | ||
is-latest: ${{steps.compare-tags.output.is-latest}} | ||
version-name: ${{ github.ref_name }} | ||
is-latest: ${{ steps.compare-tags.output.is-latest }} | ||
steps: | ||
- uses: joutvhu/[email protected] | ||
id: latest-release | ||
with: | ||
latest: true | ||
throwing: false | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Compare tags | ||
id: compare-tags | ||
env: | ||
REF_TYPE: ${{ github.ref_type }} | ||
REF_NAME: ${{ github.ref_name }} | ||
LATEST_TAG: ${{ steps.latest-release.outputs.tag_name }} | ||
run: | | ||
if [ '${{github.ref_type}}' == 'tag' ] && [ '${{steps.latest-release.outputs.tag_name}}' == '${{github.ref_name}}' ]; then | ||
if [ "${REF_TYPE}" == 'tag' ] && [ "${REF_NAME}" == "${LATEST_TAG}" ]; then | ||
echo 'is-latest=true' >> "${GITHUB_OUTPUT}" | ||
else | ||
echo 'is-latest=false' >> "${GITHUB_OUTPUT}" | ||
|
@@ -34,7 +38,7 @@ jobs: | |
spm-context: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
package-dump: ${{steps.dump-package.outputs.package-dump}} | ||
package-dump: ${{ steps.dump-package.outputs.package-dump }} | ||
steps: | ||
- uses: swift-actions/[email protected] | ||
id: swift-setup | ||
|
@@ -60,7 +64,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target: ${{fromJson(needs.spm-context.outputs.package-dump).products.*.targets.*}} | ||
target: ${{ fromJson(needs.spm-context.outputs.package-dump).products.*.targets.* }} | ||
steps: | ||
- uses: swift-actions/[email protected] | ||
id: swift-setup | ||
|
@@ -73,27 +77,29 @@ jobs: | |
- uses: actions/[email protected] | ||
with: | ||
path: .build | ||
key: ${{runner.os}}-${{steps.os-version.outputs.version}}-${{github.repository}}-spm-${{steps.swift-setup.outputs.version}}-${{hashFiles('**/Package.resolved')}} | ||
key: ${{ runner.os }}-${{ steps.os-version.outputs.version }}-${{ github.repository }}-spm-${{ steps.swift-setup.outputs.version }}-${{ hashFiles('**/Package.resolved') }} | ||
restore-keys: | | ||
${{runner.os}}-${{steps.os-version.outputs.version}}-${{github.repository}}-spm-${{steps.swift-setup.outputs.version}}- | ||
${{ runner.os }}-${{ steps.os-version.outputs.version }}-${{ github.repository }}-spm-${{ steps.swift-setup.outputs.version }}- | ||
- uses: sersoft-gmbh/[email protected] | ||
env: | ||
ENABLE_DOCC_SUPPORT: '1' | ||
DOCC_JSON_PRETTYPRINT: 'YES' | ||
with: | ||
package-version: ${{needs.release-context.outputs.version-name}} | ||
targets: ${{matrix.target}} | ||
package-version: ${{ needs.release-context.outputs.version-name }} | ||
targets: ${{ matrix.target }} | ||
enable-inherited-docs: true | ||
enable-index-building: false | ||
transform-for-static-hosting: true | ||
hosting-base-path: ${{github.event.repository.name}}/${{needs.release-context.outputs.version-name}} | ||
output: ${{matrix.target}}-docs | ||
hosting-base-path: ${{ github.event.repository.name }}/${{ needs.release-context.outputs.version-name }} | ||
output: ${{ matrix.target }}-docs | ||
- name: Package docs | ||
run: tar -cvf '${{matrix.target}}-docs.tar' '${{matrix.target}}-docs' | ||
env: | ||
TARGET: ${{ matrix.target }} | ||
run: tar -cvf "${TARGET}-docs.tar" "${TARGET}-docs" | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{matrix.target}}-docs | ||
path: ${{matrix.target}}-docs.tar | ||
name: ${{ matrix.target }}-docs | ||
path: ${{ matrix.target }}-docs.tar | ||
|
||
publish-docs: | ||
needs: | ||
|
@@ -113,8 +119,8 @@ jobs: | |
run: find artifacts -name '*.tar' -execdir tar -xvf '{}' --strip-components 1 \; -delete | ||
- name: Merge documentations | ||
env: | ||
TARGETS: ${{join(fromJson(needs.spm-context.outputs.package-dump).products.*.targets.*, ' ')}} | ||
DOCS_BASE_DIR: repository/${{needs.release-context.outputs.version-name}} | ||
TARGETS: ${{ join(fromJson(needs.spm-context.outputs.package-dump).products.*.targets.*, ' ') }} | ||
DOCS_BASE_DIR: repository/${{ needs.release-context.outputs.version-name }} | ||
run: | | ||
rm -rf "${DOCS_BASE_DIR}" | ||
is_first=1 | ||
|
@@ -134,9 +140,10 @@ jobs: | |
- name: Create version index | ||
working-directory: repository | ||
env: | ||
TARGET_DOCS_DIR: ${{needs.release-context.outputs.version-name}}/documentation | ||
INDEX_FILE: ${{needs.release-context.outputs.version-name}}/index.html | ||
BASE_URL: 'https://${{github.repository_owner}}.github.io/${{github.event.repository.name}}/${{needs.release-context.outputs.version-name}}/documentation' | ||
TARGET_DOCS_DIR: ${{ needs.release-context.outputs.version-name }}/documentation | ||
INDEX_FILE: ${{ needs.release-context.outputs.version-name }}/index.html | ||
BASE_URL: 'https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ needs.release-context.outputs.version-name }}/documentation' | ||
REPO_NAME: ${{ github.event.repository.name }} | ||
run: | | ||
target_count=0 | ||
target_list="" | ||
|
@@ -154,7 +161,7 @@ jobs: | |
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>${{github.event.repository.name}} Documentation</title> | ||
<title>${REPO_NAME} Documentation</title> | ||
</head> | ||
<body> | ||
<ul> | ||
|
@@ -169,7 +176,7 @@ jobs: | |
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>${{github.event.repository.name}} Documentation</title> | ||
<title>${REPO_NAME} Documentation</title> | ||
<meta http-equiv="refresh" content="0; url=${BASE_URL}/${single_target_name}" /> | ||
</head> | ||
<body> | ||
|
@@ -181,13 +188,14 @@ jobs: | |
- name: Create root index | ||
working-directory: repository | ||
env: | ||
REDIRECT_URL: 'https://${{github.repository_owner}}.github.io/${{github.event.repository.name}}/latest' | ||
REDIRECT_URL: 'https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/latest' | ||
REPO_NAME: ${{ github.event.repository.name }} | ||
run: | | ||
cat > 'index.html' <<EOF | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>${{github.event.repository.name}} Documentation</title> | ||
<title>${REPO_NAME} Documentation</title> | ||
<meta http-equiv="refresh" content="0; url=${REDIRECT_URL}" /> | ||
</head> | ||
<body> | ||
|
@@ -196,11 +204,13 @@ jobs: | |
</html> | ||
EOF | ||
- name: Create latest symlink | ||
if: ${{needs.release-context.outputs.is-latest}} | ||
if: ${{ needs.release-context.outputs.is-latest }} | ||
working-directory: repository | ||
env: | ||
VERSION_NAME: ${{ needs.release-context.outputs.version-name }} | ||
run: | | ||
rm -f 'latest' | ||
ln -s '${{needs.release-context.outputs.version-name}}' 'latest' | ||
ln -s "${VERSION_NAME}" 'latest' | ||
- name: Determine changes | ||
id: check-changes | ||
working-directory: repository | ||
|
@@ -211,19 +221,19 @@ jobs: | |
echo 'has-changes=false' >> "${GITHUB_OUTPUT}" | ||
fi | ||
- uses: crazy-max/[email protected] | ||
if: ${{steps.check-changes.outputs.has-changes}} | ||
if: ${{ steps.check-changes.outputs.has-changes }} | ||
with: | ||
keep_history: true | ||
build_dir: repository | ||
commit_message: Deploy documentation for '${{needs.release-context.outputs.version-name}}' | ||
commit_message: Deploy documentation for '${{ needs.release-context.outputs.version-name }}' | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
cleanup: | ||
needs: | ||
- generate-docs | ||
- publish-docs | ||
if: always() | ||
if: ${{ always() }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cleanup Artifacts | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,20 +30,20 @@ jobs: | |
swift-version: 5.7 | ||
xcode-version: '' | ||
|
||
runs-on: ${{matrix.os}} | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- if: runner.os == 'macOS' | ||
- if: ${{ runner.os == 'macOS' }} | ||
uses: maxim-lobanov/[email protected] | ||
with: | ||
xcode-version: ${{matrix.xcode-version}} | ||
xcode-version: ${{ matrix.xcode-version }} | ||
- name: Install Swift | ||
if: runner.os == 'Linux' | ||
if: ${{ runner.os == 'Linux' }} | ||
uses: sersoft-gmbh/[email protected] | ||
with: | ||
release-version: ${{matrix.swift-version}} | ||
platform: ${{matrix.os}} | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
release-version: ${{ matrix.swift-version }} | ||
platform: ${{ matrix.os }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Read OS Version | ||
uses: sersoft-gmbh/[email protected] | ||
id: os-version | ||
|
@@ -54,9 +54,9 @@ jobs: | |
- uses: actions/[email protected] | ||
with: | ||
path: .build | ||
key: ${{runner.os}}-${{steps.os-version.outputs.version}}-${{github.repository}}-spm-${{steps.swift-version.outputs.version}}-${{hashFiles('**/Package.resolved')}} | ||
key: ${{ runner.os }}-${{ steps.os-version.outputs.version }}-${{ github.repository }}-spm-${{ steps.swift-version.outputs.version }}-${{ hashFiles('**/Package.resolved') }} | ||
restore-keys: | | ||
${{runner.os}}-${{steps.os-version.outputs.version}}-${{github.repository}}-spm-${{steps.swift-version.outputs.version}}- | ||
${{ runner.os }}-${{ steps.os-version.outputs.version }}-${{ github.repository }}-spm-${{ steps.swift-version.outputs.version }}- | ||
- name: Workaround Package.resolved format issues | ||
if: ${{ startsWith(steps.swift-version.outputs.version, '5.5') }} | ||
run: rm -rf Package.resolved | ||
|
@@ -67,8 +67,8 @@ jobs: | |
id: coverage-files | ||
- uses: codecov/[email protected] | ||
with: | ||
token: ${{secrets.CODECOV_TOKEN}} | ||
files: ${{join(fromJSON(steps.coverage-files.outputs.files), ',')}} | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }} | ||
fail_ci_if_error: true | ||
|
||
test-xcode: | ||
|
@@ -90,6 +90,6 @@ jobs: | |
id: coverage-files | ||
- uses: codecov/[email protected] | ||
with: | ||
token: ${{secrets.CODECOV_TOKEN}} | ||
files: ${{join(fromJSON(steps.coverage-files.outputs.files), ',')}} | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }} | ||
fail_ci_if_error: true |