{"id":17090840,"url":"https://github.com/phimage/action-swift-cli-build","last_synced_at":"2025-07-05T22:33:40.511Z","repository":{"id":62832310,"uuid":"562887286","full_name":"phimage/action-swift-cli-build","owner":"phimage","description":"Build swift cli tool on macOS or ubuntu","archived":false,"fork":false,"pushed_at":"2022-11-11T23:10:58.000Z","size":21,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-28T22:18:26.281Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phimage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-07T13:19:25.000Z","updated_at":"2023-02-07T17:22:20.000Z","dependencies_parsed_at":"2023-01-05T13:21:12.655Z","dependency_job_id":null,"html_url":"https://github.com/phimage/action-swift-cli-build","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"3aa596c8a6ec748f2905fdc5f9cd863fc6d8b764"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phimage%2Faction-swift-cli-build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phimage%2Faction-swift-cli-build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phimage%2Faction-swift-cli-build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phimage%2Faction-swift-cli-build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phimage","download_url":"https://codeload.github.com/phimage/action-swift-cli-build/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245128130,"owners_count":20565206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T13:56:52.734Z","updated_at":"2025-03-23T16:12:55.634Z","avatar_url":"https://github.com/phimage.png","language":null,"readme":"# action-swift-cli-build\n\nBuild swift cli tool on macOS or ubuntu, to run it or attach it to release\n\nExample in template [swift-cli-template](https://github.com/phimage/swift-cli-template)\n\n## Build and use\n\n```yaml\njobs:\n  build:\n    name: Swift on ${{ matrix.os }}\n    runs-on: ${{ matrix.os }}\n    strategy:\n      matrix:\n        os: [ubuntu-latest, macos-latest]\n    steps:\n    - uses: phimage/action-swift-cli-build@v1\n      with:\n        swift-version: \"5.7\"\n        bin-name: \"my-binary-name\"\n    - name: Launch my compile cli tools\n      run: |\n        $BINARY --help\n```\n\n## Release\n\nTo upload to a release when publishing it, use `upload-to-release` and pass the `repo-token`.\n\n```yaml\nname: release\n\non: \n  release:\n    types: [published]\n\njobs:\n  build:\n    name: Swift on ${{ matrix.os }}\n    runs-on: ${{ matrix.os }}\n    strategy:\n      matrix:\n        os: [ubuntu-latest, macos-latest]\n    steps:\n    - uses: phimage/action-swift-cli-build@v1\n      with:\n        swift-version: \"5.7\"\n        bin-name: \"my-binary-name\"\n        upload-to-release: true\n        repo-token: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Propose an install bash script\n\nA user then could launch a simple command to install your binary from release assets\n\n```bash\nsudo curl -sL https://\u003corga\u003e.github.io/\u003cproject\u003e/install.sh | bash\n```\n\nTo do so, first active the [github pages](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages).\n\nThen create an \"install.sh\" script in your project and do not forget to edit `binary` and `repository` variable to match your project needs.\n\n```bash\n#!/usr/bin/env bash\n\nbinary_name=\"yourbinary\"\nrepository=\"orga/project\"\n\nTMP=\"${TMPDIR}\"\nif [ \"x$TMP\" = \"x\" ]; then\n  TMP=\"/tmp/\"\nfi\nTMP=\"${TMP}cli.$$\"\nrm -rf \"$TMP\" || true\nmkdir \"$TMP\"\nif [ $? -ne 0 ]; then\n  echo \"failed to mkdir $TMP\" \u003e\u00262\n  exit 1\nfi\n\ncd $TMP\n\nif [[ \"$OSTYPE\" == \"linux-gnu\" ]]; then\n  . /etc/lsb-release\n  if [ \"$DISTRIB_ID\" != \"Ubuntu\" ]; then\n    echo \"Only ubuntu supported\"\n    exit 1\n  fi\n  archiveName=$binary_name-x86_64-static-ubuntu-$DISTRIB_CODENAME.zip\nelif [[ \"$OSTYPE\" == \"darwin\"* ]]; then  # Mac OSX\n  archiveName=$binary_name.zip\nelse\n  echo \"Unknown os type $OSTYPE, macOS or ubuntu\"\n  exit 1\nfi\n\narchive=$TMP/$archiveName\ncurl -sL https://github.com/$repository/releases/latest/download/$archiveName -o $archive\n\nif [[ \"$OSTYPE\" == \"darwin\"* ]]; then  # Mac OSX\n  unzip -q $archive -d $TMP/\nelse\n  unzip -q $archive -d $TMP/\nfi\n\nbinary=$TMP/$binary_name \n\ndst=\"/usr/local/bin\"\necho \"Install into $dst/$binary_name\"\nsudo rm -f $dst/$binary_name\nsudo cp $binary $dst/\n\nrm -rf \"$TMP\"\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphimage%2Faction-swift-cli-build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphimage%2Faction-swift-cli-build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphimage%2Faction-swift-cli-build/lists"}