Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve GitHub Actions #118

Open
discombobulateme opened this issue Feb 25, 2021 · 1 comment
Open

Improve GitHub Actions #118

discombobulateme opened this issue Feb 25, 2021 · 1 comment
Assignees
Labels
hacktoberfest Open for contributions to Hacktoberfest 2021 integration Adding integration: manual or automatic

Comments

@discombobulateme
Copy link
Collaborator

No description provided.

@discombobulateme
Copy link
Collaborator Author

Actions are now repeating themselves no enable verification when failed (if it happened on daily check or on push).
But ideally, "on push" action wouldn't need to re-verify the repositories, as it should be mainly frontend changes.
Ideally actions would be differentiated at:

  • DailyCheck: would make sure it is daily linted
  • Deploy: would run after DailyCheck and on push to main

This is how it suppose to work:

DailyCheck action, lints the repositories and save frontend.json file as an artifact

name: Verify Repo Health Daily

on:
  schedule:
    - cron: '0 0 * * *'

jobs:
  Lint-Deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Gives access to repository
        uses: actions/checkout@v2
      - name: Setup Node version
        uses: actions/setup-node@v1
        with:
          node-version: '12'

      - name: Install dependencies
        run: npm install

      - name: Generate frontend data
        run: node src/index.js

      - name: Upload artifact
         uses: actions/upload-artifact@v2
         with:
           name: frontend-json
           path: frontend/public/frontend.json
           retention-days: 1

This artifact stays available for both on push to main or, to be deployed right after this job ends:

name: Deploy to GitHub Pages

on:
  push:
      branches:
        - main

  workflow_run:
    workflows: ["Verify Repo Health Daily", "Lint And Deploy On Push To Main"]
    types:
      - completed

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Gives access to repository
        uses: actions/checkout@v2
      - name: Setup Node version
        uses: actions/setup-node@v1
        with:
          node-version: '12'

      - name: Install Frontend
        run: cd frontend && npm install

      - name: Copy artifact to frontend
        uses: actions/download-artifact@v2
        with:
          name: frontend-json
          path: ./frontend/public

      - name: Build Vue
        run: cd frontend && npm run build

      - name: Deploy Vue Site
        uses: peaceiris/actions-gh-pages@v3
        with:
          personal_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./frontend/dist
          publish_branch: gh-pages
          user_name: 'OSS Sauce Bot'
          user_email: 'oss-sauce-bot@users.noreply.github.com'
          commit_message: ${{ github.event.head_commit.message }}
```

Right now the artifacts is created, but the Deploy action is not able to find it for downloading when the jobs are on separated files. 
I tried several times and was unable to find a resolution, so this is why this ticket exists. 

@discombobulateme discombobulateme self-assigned this Feb 25, 2021
@discombobulateme discombobulateme added the integration Adding integration: manual or automatic label Feb 25, 2021
@discombobulateme discombobulateme mentioned this issue Feb 25, 2021
2 tasks
@discombobulateme discombobulateme added the hacktoberfest Open for contributions to Hacktoberfest 2021 label Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Open for contributions to Hacktoberfest 2021 integration Adding integration: manual or automatic
Projects
None yet
Development

No branches or pull requests

1 participant