This commit is contained in:
		
							
								
								
									
										62
									
								
								.github/workflows/deploy.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								.github/workflows/deploy.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,62 @@
 | 
			
		||||
name: Deploy ailog
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches: [ main ]
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches: [ main ]
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build-and-deploy:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    
 | 
			
		||||
    steps:
 | 
			
		||||
    - uses: actions/checkout@v4
 | 
			
		||||
    
 | 
			
		||||
    - name: Install Rust
 | 
			
		||||
      uses: actions-rs/toolchain@v1
 | 
			
		||||
      with:
 | 
			
		||||
        toolchain: stable
 | 
			
		||||
        profile: minimal
 | 
			
		||||
        override: true
 | 
			
		||||
    
 | 
			
		||||
    - name: Cache cargo registry
 | 
			
		||||
      uses: actions/cache@v3
 | 
			
		||||
      with:
 | 
			
		||||
        path: ~/.cargo/registry
 | 
			
		||||
        key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
 | 
			
		||||
    
 | 
			
		||||
    - name: Cache cargo index
 | 
			
		||||
      uses: actions/cache@v3
 | 
			
		||||
      with:
 | 
			
		||||
        path: ~/.cargo/git
 | 
			
		||||
        key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
 | 
			
		||||
    
 | 
			
		||||
    - name: Cache cargo build
 | 
			
		||||
      uses: actions/cache@v3
 | 
			
		||||
      with:
 | 
			
		||||
        path: target
 | 
			
		||||
        key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
 | 
			
		||||
    
 | 
			
		||||
    - name: Build ailog
 | 
			
		||||
      run: cargo build --release
 | 
			
		||||
    
 | 
			
		||||
    - name: Generate static site
 | 
			
		||||
      run: |
 | 
			
		||||
        ./target/release/ailog build my-blog
 | 
			
		||||
        touch my-blog/public/.nojekyll
 | 
			
		||||
        
 | 
			
		||||
    - name: Setup Cloudflare Pages
 | 
			
		||||
      run: |
 | 
			
		||||
        # Cloudflare Pages用の設定
 | 
			
		||||
        echo '/*    /index.html   200' > my-blog/public/_redirects
 | 
			
		||||
        echo 'X-Frame-Options: DENY' > my-blog/public/_headers
 | 
			
		||||
        echo 'X-Content-Type-Options: nosniff' >> my-blog/public/_headers
 | 
			
		||||
    
 | 
			
		||||
    - name: Deploy to GitHub Pages
 | 
			
		||||
      uses: peaceiris/actions-gh-pages@v3
 | 
			
		||||
      if: github.ref == 'refs/heads/main'
 | 
			
		||||
      with:
 | 
			
		||||
        github_token: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
        publish_dir: ./my-blog/public
 | 
			
		||||
        publish_branch: gh-pages
 | 
			
		||||
		Reference in New Issue
	
	Block a user