diff --git a/.github/workflows/builds.hex.pm.yml b/.github/workflows/builds.hex.pm.yml deleted file mode 100644 index f263f5a7c4..0000000000 --- a/.github/workflows/builds.hex.pm.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: builds.hex.pm - -on: - push: - branches: - - main - - v*.* - tags: - - v* - -env: - ELIXIR_OPTS: "--warnings-as-errors" - ERLC_OPTS: "warnings_as_errors" - LANG: C.UTF-8 - -concurrency: builds_txt - -jobs: - release_pre_built: - strategy: - fail-fast: true - max-parallel: 1 - matrix: - include: - - otp: 23 - otp_version: '23.3' - build_docs: build_docs - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 50 - - name: Get tags - run: git fetch --tags origin - - uses: ./.github/workflows/release_pre_built - with: - otp_version: ${{ matrix.otp_version }} - otp: ${{ matrix.otp }} - build_docs: ${{ matrix.build_docs }} - - name: Utils.sh - run: | - cat << 'EOF' > utils.sh - function purge_key() { - curl \ - -X POST \ - -H "Fastly-Key: ${FASTLY_KEY}" \ - -H "Accept: application/json" \ - -H "Content-Length: 0" \ - "https://api.fastly.com/service/$1/purge/$2" - } - function purge() { - purge_key ${FASTLY_REPO_SERVICE_ID} $1 - purge_key ${FASTLY_BUILDS_SERVICE_ID} $1 - sleep 2 - purge_key ${FASTLY_REPO_SERVICE_ID} $1 - purge_key ${FASTLY_BUILDS_SERVICE_ID} $1 - sleep 2 - purge_key ${FASTLY_REPO_SERVICE_ID} $1 - purge_key ${FASTLY_BUILDS_SERVICE_ID} $1 - } - EOF - chmod +x utils.sh - - name: Upload Docs to S3 - if: ${{ matrix.build_docs }} - env: - AWS_ACCESS_KEY_ID: ${{ secrets.HEX_AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }} - AWS_REGION: ${{ secrets.HEX_AWS_REGION }} - AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }} - FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }} - FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }} - FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }} - run: | - source utils.sh - version=$(echo ${{ github.ref_name }} | sed -e 's/^v//g') - for f in doc/*; do - if [ -d "$f" ]; then - app=`echo $f | sed s/"doc\/"//` - tarball="${app}-${version}.tar.gz" - surrogate_key="docs/${app}-${version}" - tar -czf "${tarball}" -C "doc/${app}" . - aws s3 cp "${tarball}" "s3://${{ env.AWS_S3_BUCKET }}/docs/${tarball}" \ - --cache-control "public,max-age=3600" \ - --metadata "{\"surrogate-key\":\"${surrogate_key}\",\"surrogate-control\":\"public,max-age=604800\"}" - purge "${surrogate_key}" - fi - done diff --git a/.github/workflows/release_pre_built/action.yml b/.github/workflows/release_pre_built/action.yml deleted file mode 100644 index e8d0630141..0000000000 --- a/.github/workflows/release_pre_built/action.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: "Release pre built" -description: "Builds elixir release, ExDoc and generates docs" -inputs: - otp: - description: "The major OTP version" - otp_version: - description: "The exact OTP version (major.minor[.patch])" - build_docs: - description: "If docs have to be built or not" -runs: - using: "composite" - steps: - - uses: erlef/setup-beam@v1 - with: - otp-version: ${{ inputs.otp_version }} - version-type: strict - - name: Build Elixir Release - shell: bash - run: | - make Precompiled.zip - mv Precompiled.zip elixir-otp-${{ inputs.otp }}.zip - shasum -a 1 elixir-otp-${{ inputs.otp }}.zip > elixir-otp-${{ inputs.otp }}.zip.sha1sum - shasum -a 256 elixir-otp-${{ inputs.otp }}.zip > elixir-otp-${{ inputs.otp }}.zip.sha256sum - echo "$PWD/bin" >> $GITHUB_PATH - - name: Get latest stable ExDoc version - if: ${{ inputs.build_docs }} - shell: bash - run: | - EX_DOC_LATEST_STABLE_VERSION=$(curl -s https://hex.pm/api/packages/ex_doc | jq --raw-output '.latest_stable_version') - echo "EX_DOC_LATEST_STABLE_VERSION=${EX_DOC_LATEST_STABLE_VERSION}" >> $GITHUB_ENV - - uses: actions/checkout@v3 - if: ${{ inputs.build_docs }} - with: - repository: elixir-lang/ex_doc - ref: v${{ env.EX_DOC_LATEST_STABLE_VERSION }} - path: ex_doc - - name: Build ex_doc - if: ${{ inputs.build_docs }} - shell: bash - run: | - mv ex_doc ../ex_doc - cd ../ex_doc - ../elixir/bin/mix do local.rebar --force, local.hex --force, deps.get, compile - cd ../elixir - - name: Build Docs - if: ${{ inputs.build_docs }} - shell: bash - run: | - make Docs.zip - shasum -a 1 Docs.zip > Docs.zip.sha1sum - shasum -a 256 Docs.zip > Docs.zip.sha256sum diff --git a/Makefile b/Makefile index 10d21893cf..1a9ed05229 100644 --- a/Makefile +++ b/Makefile @@ -177,48 +177,40 @@ clean_residual_files: LOGO_PATH = $(shell test -f ../docs/logo.png && echo "--logo ../docs/logo.png") SOURCE_REF = $(shell tag="$(call GIT_TAG)" revision="$(call GIT_REVISION)"; echo "$${tag:-$$revision}") - DOCS_FORMAT = html -DOCS_COMPILE = CANONICAL=$(CANONICAL) bin/elixir ../ex_doc/bin/ex_doc "$(1)" "$(VERSION)" "lib/$(2)/ebin" --main "$(3)" --source-url "https://github.com/elixir-lang/elixir" --source-ref "$(call SOURCE_REF)" $(call LOGO_PATH) --output doc/$(2) --canonical "https://hexdocs.pm/$(2)/$(CANONICAL)" --homepage-url "https://elixir-lang.org/docs.html" --formatter "$(DOCS_FORMAT)" $(4) -DOCS_CONFIG = bin/elixir lib/elixir/scripts/docs_config.exs "$(1)" +COMPILE_DOCS = bin/elixir ../ex_doc/bin/ex_doc "$(1)" "$(VERSION)" "lib/$(2)/ebin" --main "$(3)" --source-url "https://github.com/elixir-lang/elixir" --source-ref "$(call SOURCE_REF)" $(call LOGO_PATH) --output doc/$(2) --canonical "https://hexdocs.pm/$(2)/$(CANONICAL)" --homepage-url "https://elixir-lang.org/docs.html" --formatter "$(DOCS_FORMAT)" $(4) docs: compile ../ex_doc/bin/ex_doc docs_elixir docs_eex docs_mix docs_iex docs_ex_unit docs_logger docs_elixir: compile ../ex_doc/bin/ex_doc @ echo "==> ex_doc (elixir)" $(Q) rm -rf doc/elixir - $(call DOCS_COMPILE,Elixir,elixir,Kernel,--config "lib/elixir/scripts/elixir_docs.exs") - $(call DOCS_CONFIG,elixir) + $(call COMPILE_DOCS,Elixir,elixir,Kernel,--config "lib/elixir/docs.exs") docs_eex: compile ../ex_doc/bin/ex_doc @ echo "==> ex_doc (eex)" $(Q) rm -rf doc/eex - $(call DOCS_COMPILE,EEx,eex,EEx,--config "lib/elixir/scripts/mix_docs.exs") - $(call DOCS_CONFIG,eex) + $(call COMPILE_DOCS,EEx,eex,EEx) docs_mix: compile ../ex_doc/bin/ex_doc @ echo "==> ex_doc (mix)" $(Q) rm -rf doc/mix - $(call DOCS_COMPILE,Mix,mix,Mix,--config "lib/elixir/scripts/mix_docs.exs") - $(call DOCS_CONFIG,mix) + $(call COMPILE_DOCS,Mix,mix,Mix) docs_iex: compile ../ex_doc/bin/ex_doc @ echo "==> ex_doc (iex)" $(Q) rm -rf doc/iex - $(call DOCS_COMPILE,IEx,iex,IEx,--config "lib/elixir/scripts/mix_docs.exs") - $(call DOCS_CONFIG,iex) + $(call COMPILE_DOCS,IEx,iex,IEx) docs_ex_unit: compile ../ex_doc/bin/ex_doc @ echo "==> ex_doc (ex_unit)" $(Q) rm -rf doc/ex_unit - $(call DOCS_COMPILE,ExUnit,ex_unit,ExUnit,--config "lib/elixir/scripts/mix_docs.exs") - $(call DOCS_CONFIG,ex_unit) + $(call COMPILE_DOCS,ExUnit,ex_unit,ExUnit) docs_logger: compile ../ex_doc/bin/ex_doc @ echo "==> ex_doc (logger)" $(Q) rm -rf doc/logger - $(call DOCS_COMPILE,Logger,logger,Logger,--config "lib/elixir/scripts/mix_docs.exs") - $(call DOCS_CONFIG,logger) + $(call COMPILE_DOCS,Logger,logger,Logger) ../ex_doc/bin/ex_doc: @ echo "ex_doc is not found in ../ex_doc as expected. See README for more information." @@ -227,23 +219,23 @@ docs_logger: compile ../ex_doc/bin/ex_doc #==> Zip tasks Docs.zip: docs - rm -f Docs.zip - zip -9 -r Docs.zip CHANGELOG.md doc NOTICE LICENSE README.md - @ echo "Docs file created $(CURDIR)/Docs.zip" + rm -f Docs-v$(VERSION).zip + zip -9 -r Docs-v$(VERSION).zip CHANGELOG.md doc NOTICE LICENSE README.md + @ echo "Docs file created $(CURDIR)/Docs-v$(VERSION).zip" Precompiled.zip: build_man compile - rm -f Precompiled.zip - zip -9 -r Precompiled.zip bin CHANGELOG.md lib/*/ebin lib/*/lib LICENSE man NOTICE README.md VERSION - @ echo "Precompiled file created $(CURDIR)/Precompiled.zip" + rm -f Precompiled-v$(VERSION).zip + zip -9 -r Precompiled-v$(VERSION).zip bin CHANGELOG.md lib/*/ebin lib/*/lib LICENSE man NOTICE README.md VERSION + @ echo "Precompiled file created $(CURDIR)/Precompiled-v$(VERSION).zip" zips: Precompiled.zip Docs.zip @ echo "" @ echo "### Checksums" @ echo "" - @ shasum -a 1 < Precompiled.zip | sed -e "s/-//" | xargs echo " * Precompiled.zip SHA1:" - @ shasum -a 512 < Precompiled.zip | sed -e "s/-//" | xargs echo " * Precompiled.zip SHA512:" - @ shasum -a 1 < Docs.zip | sed -e "s/-//" | xargs echo " * Docs.zip SHA1:" - @ shasum -a 512 < Docs.zip | sed -e "s/-//" | xargs echo " * Docs.zip SHA512:" + @ shasum -a 1 < Precompiled-v$(VERSION).zip | sed -e "s/-//" | xargs echo " * Precompiled.zip SHA1:" + @ shasum -a 512 < Precompiled-v$(VERSION).zip | sed -e "s/-//" | xargs echo " * Precompiled.zip SHA512:" + @ shasum -a 1 < Docs-v$(VERSION).zip | sed -e "s/-//" | xargs echo " * Docs.zip SHA1:" + @ shasum -a 512 < Docs-v$(VERSION).zip | sed -e "s/-//" | xargs echo " * Docs.zip SHA512:" @ echo "" #==> Test tasks diff --git a/lib/elixir/scripts/elixir_docs.exs b/lib/elixir/docs.exs similarity index 100% rename from lib/elixir/scripts/elixir_docs.exs rename to lib/elixir/docs.exs diff --git a/lib/elixir/scripts/docs_config.exs b/lib/elixir/scripts/docs_config.exs deleted file mode 100644 index e241017320..0000000000 --- a/lib/elixir/scripts/docs_config.exs +++ /dev/null @@ -1,19 +0,0 @@ -# Generate docs_config.js for version chooser in ExDoc -[app] = System.argv() - -{text_tags, 0} = System.cmd("git", ["tag"]) -skipped = Version.parse!("1.0.3") - -list_contents = - text_tags - |> String.split() - |> Enum.map(fn "v" <> rest -> Version.parse!(rest) end) - |> Enum.filter(&(Version.compare(&1, skipped) == :gt)) - |> Enum.sort({:desc, Version}) - |> Enum.map_intersperse(", ", fn version -> - version_string = to_string(version) - ~s[{"version":"v#{version_string}", "url":"https://hexdocs.pm/#{app}/#{version_string}"}] - end) - -File.mkdir_p!("doc/#{app}") -File.write!("doc/#{app}/docs_config.js", ["var versionNodes = [", list_contents, "];\n"]) diff --git a/lib/elixir/scripts/mix_docs.exs b/lib/elixir/scripts/mix_docs.exs deleted file mode 100644 index a5b76f55ee..0000000000 --- a/lib/elixir/scripts/mix_docs.exs +++ /dev/null @@ -1,12 +0,0 @@ -canonical = System.fetch_env!("CANONICAL") - -[ - deps: [ - eex: "https://hexdocs.pm/eex/#{canonical}", - elixir: "https://hexdocs.pm/elixir/#{canonical}", - ex_unit: "https://hexdocs.pm/ex_unit/#{canonical}", - iex: "https://hexdocs.pm/iex/#{canonical}", - logger: "https://hexdocs.pm/logger/#{canonical}", - mix: "https://hexdocs.pm/mix/#{canonical}" - ] -]