Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alvarogarciapiz/gawg-build

This action belongs to the GAWG workflow and is used to build a project and package it to deploy it in a future Github actions job.
https://github.com/alvarogarciapiz/gawg-build

actions gawg workflows

Last synced: 3 months ago
JSON representation

This action belongs to the GAWG workflow and is used to build a project and package it to deploy it in a future Github actions job.

Awesome Lists containing this project

README

        

# GAWG Build Action

This GitHub Action checks the technology used in the project (Python, Node.js, or Maven), performs a build operation, and then uploads the resulting build artifacts. The artifacts are retained for a specified number of days. This action is useful for continuous integration workflows where you want to build your project and store the build output for later use or deployment.

**Author:** Álvaro García Pizarro

## Description

This action is intended to be used only with the GAWG workflow. It is not for commercial use and does not support collaboration. Below is an explanation of how it works, including inputs, outputs, and supported technologies.

## Inputs

- **technology** (required): The technology to use for the build. Available options are `maven`, `python`, and `node`.
- **config-json** (required): A JSON string containing workflow config parameters.

## Outputs

- **ARTIFACT_NAME**: The name of the artifact generated by the build.

## Supported Technologies

- **Maven**
- **Python**
- **Node.js**

## How It Works

1. **Validate Technology**: The action first validates the specified technology to ensure it is one of the supported options (`maven`, `python`, `node`).

2. **Generate Artifact Name**: It generates a unique artifact name based on the project name, technology, and the current timestamp.

3. **Set Up Environment**: Depending on the specified technology, it sets up the appropriate environment:
- **Maven**: Sets up the Java environment using `actions/setup-java@v4`.
- **Python**: Sets up the Python environment using `actions/setup-python@v5`.
- **Node.js**: Sets up the Node.js environment using `actions/setup-node@v4`.

4. **Build Project**: It performs the build operation for the specified technology:
- **Maven**: Runs `mvn clean install`.
- **Python**: Installs dependencies using `pip` and builds the project.
- **Node.js**: Installs dependencies using `npm` and builds the project.

5. **Create Artifact**: Finally, it uploads the build artifacts using `actions/upload-artifact@v4`, with the retention period specified in the config JSON.

## Example Usage

```yaml
name: Build and Upload Artifacts

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Run GAWG Build Action
uses: ./
with:
technology: 'python'
config-json: '{"PROJECT_NAME":"gawg","RETENTION_DAYS":"1","JAVA_VERSION":"8","PYTHON_VERSION":"3.10","NODE_VERSION":"18","NODE_DIST_DIR":"dist/","PYTHON_DIST_DIR":"./","JAVA_DIST_DIR":"target/","JAVA_DISTRIBUTION":"temurin"}'
```

This example demonstrates how to use the GAWG Build Action in a GitHub Actions workflow. It checks out the code, runs the build action with the specified technology and configuration, and uploads the resulting artifacts.