diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..8b68fc34 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: deploy +on: + workflow_dispatch: + push: + branches: + - main + - master + paths: + - 'README.rdoc' + - 'src/**/*' +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + actions: write + steps: + - uses: actions/create-github-app-token@v3 + id: koans-deploy-app-token + with: + client-id: ${{ vars.DEPLOY_APP_CLIENT_ID }} + private-key: ${{ secrets.DEPLOY_APP_SECRET_KEY }} + owner: edgecase + repositories: ruby_koans + permission-contents: write + - uses: actions/checkout@v7 + with: + token: ${{ steps.koans-deploy-app-token.outputs.token }} + - run: 'rake package' + - run: |- + git config --global user.name 'GitHub Actions' + git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' + git add download/ + git commit -m 'Update download .zip file [skip ci]' || true + git push diff --git a/DEPLOYING b/DEPLOYING index 3b91dc39..c74e47ca 100644 --- a/DEPLOYING +++ b/DEPLOYING @@ -1,12 +1,15 @@ = Deploying a new Ruby Koans ZIP file The "Download" button on the rubykoans.com web-site points to the -download/rubykoans.zip file in the github repository. So to update the -download target on the web-site, just rebuild the .zip file, commit -and push the changes. +download/rubykoans.zip file in the GitHub repository. That file is +automatically updated by GitHub Actions when the source files are +updated. + +It can, of course, also be updated manually. To do so, just rebuild +the .zip file, commit, and push the changes. rake package git add download git push -That's it. \ No newline at end of file +That's it. diff --git a/Rakefile b/Rakefile index 45f5df42..af02d9d2 100755 --- a/Rakefile +++ b/Rakefile @@ -92,18 +92,13 @@ task :clobber_zip do rm ZIP_FILE end -file ZIP_FILE => KOAN_FILES + [DOWNLOAD_DIR] do +file ZIP_FILE => [:gen, DOWNLOAD_DIR] do sh "zip #{ZIP_FILE} #{PROB_DIR}/*" end desc "Create packaged files for distribution" task :package => [ZIP_FILE] -desc "Upload the package files to the web server" -task :upload => [ZIP_FILE] do - sh "scp #{ZIP_FILE} linode:sites/onestepback.org/download" -end - desc "Generate the Koans from the source files from scratch." task :regen => [:clobber_koans, :gen]